Nette 2.2: registering filters
- robix
- Member | 4
Hi,
I have been trying for several hours to understand the new way Latte is
integrated in Nette 2.2 but I got completely lost in the docs, APIs and
sources. Many topics seem to be quite related to my problem but I haven't found
an answer.
I would like to apply my own filter on the template before Latte is applied.
In Nette 2.1, I used to redefine the templatePrepareFilters()
in
my BasePresenter like this:
Now in 2.2, the registerFilter
is deprecated. What's the
recommended replacement?
Thanks for any hint!
- Milo
- Nette Core | 1283
MartyIX: New Latte filter
is the synonym for
the old Latte helper
. So helpers = filters
now.
robix: Old template filters are not supported/implemented in the alone Latte. You can check the current deprecated behaviour and copy it by your own. Maybe someone else give you a better hint :(
- robix
- Member | 4
Thanks for reply. I have been looking into the code and it seems that in
2.2.1, Latte is directly bound to the template used in the presenter. I.e. for
using something different, I have to create another Template
class
and change the rendering. However, it seems that Latte reads the template source
by itself now so I can see no space for integrating some pre-processing
filter :-(
- David Grudl
- Nette Core | 8249
You can use for loading StringLoader, see https://github.com/…oEscape.phpt#L14
- David Grudl
- Nette Core | 8249
You can do it in startup()
, little bit better is to use
createTemplate()
:
Because this is very new part of Nette and default Loader is under development, inherit your loader from the original one (for forward compatibility):