Hi all!
I am having a problem where I can't get any Twig Extension to run.
Inside vendor/twig/twig/lib/Twig/Extension/ directory we can find some Twig extensions, but they are ot registered by default.
I've been searching through the Twig Extension Documentation how to do it but I am not sure how to do it properly and clean.
I grep'ed all the october searching for the Twig initialization code new Twig_Environment and found two probable places:
./modules/system/ServiceProvider.php:75: $twigEnvironment = new Twig_Environment(new TwigLoader(), ['auto_reload' => true]);
./modules/cms/classes/Controller.php:213: $this->twig = new Twig_Environment($this->loader, $options);
The second seeming more adequate to me as is the place where October registers his own Twig Extension.
But I am a little reticent to include the Extension source and then call addExtension for each one I want to load.
Can you give me some advice?
Last updated