Closed gmzu closed 3 years ago
I guess it's just the call here... try
\Preview::instance()->filter('badwords','Helper->badwords');
it doesn't work
After much testing I managed to get it to work with
\Template::instance()->filter('badwords','Helper->badwords')
After other tests, I verified that it really only works like that (I was misled by the cache)
\Template::instance()->filter('badwords','Helper::badwords')
obviously you have to declare the functions as static. In the other case it always gives an invalid '->' object operator error in template temp file
makes sense as you do not want to create new instances all the time :)
I create a new class, as explained in API reference
I later registered new filter in a controller class -> beforeRoute function with
In a template file I use
{{@text | badwords}}
but in the line in which I use the new filter I get anInvalid method NULL
As if the registration of the filter had not happened No errors if I don't use the filter in the template Tested on php 7.3.9 and 7.4.2