collect which delegate packages were effectively used

6 views
Skip to first unread message

Matteo Moci

unread,
Mar 13, 2017, 6:00:35 PM3/13/17
to Closure Templates Discuss
Hello Everyone, 
I'd like to ask if something like this is possible: 
when using different implementations of a template, 
I'd like to keep track of the ones effectively "used" during rendering. 

Let me show the example from the documentation so that my point can be clearer: 

{namespace ...}
{template ...}
  {delcall aaa.bbb.myButton allowemptydefault="false" data="..." /}
{/template}

{deltemplate aaa.bbb.myButton}
{/deltemplate}


{delpackage MyExperiment}
{namespace ...}

/** My experiment's implementation. */
{deltemplate aaa.bbb.myButton}
  ...
{/deltemplate}

At render time, when a delcall aaa.bbb.myButton needs to be resolved, Closure Templates looks at all the "active" implementations of the delegate template. 

The active implementations at render time would be [MyExperiment, SomeOtherExperiment]. 

Since the deltemplate aaa.bbb.myButton has delpackage MyExperiment, that package will be effectively used. 

Is there a way to keep track of only the effectively used delpackages? 
I looked into implementing an RendererListener, but I can’t get back the package rendered, due to the fact that RendererListener.templateRendered only takes the templateName as parameter, or maybe I just took the wrong path. 

Thanks! 

Matteo
Reply all
Reply to author
Forward
0 new messages