Hi christian, I am not sure to understand your usecase perfectly, but if I understood correctly, you would have 2 options, depending on what you need:
1. You can simply create a Subclass of STKPageModel, which contains your functionality. Presumably you can override the getNavigation() method. Then set this class as the modelClass for all your templates, or even easier, set it in the template prototype in the site definition. >From that point on your templates will be using the new model, with the new >navigation behavior. 2. If you want a "support object" rather than a template model, you can configure this under config -> /server/rendering/freemarker/sharedVariables Add a node here with the property "class" set to your custom class, and then this class will be available in ALL freemarker templates as a variable, using the name of the node as the variable name. Your class will need a no-argument constructor for this to work. The advantage of this approach would be that your variable will be available in *all* freemarker templates, also areas, components, emails, etc... Hope that helps! Regards from Vienna, Richard -----Ursprüngliche Nachricht----- Von: [email protected] [mailto:[email protected]] Im Auftrag von Christian Balaguer Jehle (via Magnolia Forums) Gesendet: Mittwoch, 09. Jänner 2013 11:28 An: Magnolia User List Betreff: [magnolia-user] Extending STKPageModel Hi all I need to somehow be able to extend the functionality of the STKPageModel because I want to change the navigation functionality (#getNavigation). I was asking myself which clean ways there are to achieve this. Should I replace the STKPageModel in the module descriptor of my module with my own class? Does this even work? Or should I introduce a new freemarker helper object e.g. "myfn" which gets injected and can be used in the ftl. And how exactly can I do this? Or are there even better ways? I want to somehow be able to call a custom method in the horizontalNavigation.ftl which returns a navigation object built by myself. Cheers -- Context is everything: http://forum.magnolia-cms.com/forum/thread.html?threadId=acfc3d41-b750-4359-9693-23ea38d0200a ---------------------------------------------------------------- For list details, see http://www.magnolia-cms.com/community/mailing-lists.html Alternatively, use our forums: http://forum.magnolia-cms.com/ To unsubscribe, E-mail to: <[email protected]> ---------------------------------------------------------------- ---------------------------------------------------------------- For list details, see http://www.magnolia-cms.com/community/mailing-lists.html Alternatively, use our forums: http://forum.magnolia-cms.com/ To unsubscribe, E-mail to: <[email protected]> ----------------------------------------------------------------
