OXID way to add a smarty modifier

Hey.
I want to add a smarty modifier. Is there an “OXID way” to archive this? I think it would work to decorate \oxUtilsView::_fillCommonSmartyProperties() or \oxUtilsView::getSmarty() and regsiter the modifier function there. But I would like to avoid overwriting existing methods (it has to run in professional edition and I don’t like to hack around in an undocumented way).

im used to put my own modifiers into the smarty/plugins folder

Into the core directory?

yes…

:eek: I wrote a module to implement an event dispatcher and now I decorated the getSmarty() method to trigger an event smarty.postInit with the newly created smarty object. Then I register an observer in another module to add the modifier. I think that should work.
But … of course it would be nice to hear somebody that could tell that OXID has implemented a way to make templates extensible without touching the core or having to use such unreliable class method extensions.

so feel free to suggest a better/reliable way

In the metadata.php add:

‘smarty’ => array(‘modifiers’ => array(‘mymodifier’, array(‘mymod/smarty/modifiers’,‘mymodifier’)));

It would be very easy to add that into the core.

My suggestion for developers that do not work at OXID is the above one. You have a function that gets the smarty object passed evers time a new smarty object will be created and you have that dacorator around the getSmarty() method that triggers the smarty.postInit event. If they change something in the the \oxViewUtils class you just have to find another way to place your hook.

Yes great and so I don’t like to hack around in an undocumented way