[ 
http://jira.magnolia-cms.com/browse/MGNLSTK-577?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Grégory Joseph updated MGNLSTK-577:
-----------------------------------

    Description: 
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. 


  was:
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:

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();
        }

That way all static methods of the class are available. 



> 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: Philipp Bärfuss
>
> 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]>
----------------------------------------------------------------

Reply via email to