[
http://jira.magnolia-cms.com/browse/MGNLSTK-577?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=26632#action_26632
]
Ernst Bunders commented on MGNLSTK-577:
---------------------------------------
So you can create properties under 'sharedVariables' that map a class to a
name, so an instance of the class is put in the rendering context under 'name'?
That sounds fine by me.
i must admit i find server/rendering/freemarker/sharedVariables a bit strange
as a location to configure this, as it seems to be a behavior of the renderer
class, so i wonder how many people will find it there (perhaps it should be a
good idea to mention this feature in the magnolia freemarker primer), lest it
will not be a 'hidden feature', as it was to me.
But thanks anyway for the follow up.
regards,
> Make it configurable what classes are included in the freemarker template
> rendering context
> -------------------------------------------------------------------------------------------
>
> Key: MGNLSTK-577
> URL: http://jira.magnolia-cms.com/browse/MGNLSTK-577
> Project: Magnolia Standard Templating Kit
> Issue Type: Improvement
> Components: templates
> Affects Versions: 1.2.3
> Reporter: Ernst Bunders
> Assignee: Grégory Joseph
> Fix For: 1.3
>
>
> It would be nice to be able to register classes under the template-renderer
> en paragraph-renderer configurations, so that those classes would be added to
> the template rendering context.
> STKTemplateRenderer could get a Map property like 'classesToInclude'
> it would be nice if modules/standard-templating-kit/template-renderers/stk
> would be watched, and new classes would be added on the fly through
> content2bean. STKTemplateRenderer would have to propagate this map to
> FreemarkerHelper
> you could do something like this in FreemarkerHelper:
> {code}
> TemplateHashModel staticModels = wrapper.getStaticModels();
> try {
> for (String name : classesToInclude.keySet()) {
> TemplateHashModel model = (TemplateHashModel)
> staticModels.get(classesToInclude.get(name));
> map.put(name, model);
> }
> } catch (TemplateModelException e) {
> e.printStackTrace();
> }
> {code}
> That way all static methods of the class are available.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://jira.magnolia-cms.com/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
----------------------------------------------------------------
For list details see
http://www.magnolia-cms.com/home/community/mailing-lists.html
To unsubscribe, E-mail to: <[email protected]>
----------------------------------------------------------------