Skip to content
Snippets Groups Projects
Commit 7f1bf627 authored by Sergio Gómez's avatar Sergio Gómez Committed by Tim van Dijen
Browse files

Added Module::getModuleURL helper function to resolve urls in twig

parent 0e8c5f0f
No related branches found
No related tags found
No related merge requests found
...@@ -313,6 +313,9 @@ class Template extends Response ...@@ -313,6 +313,9 @@ class Template extends Response
$twig = new Twig_Environment($loader, $options); $twig = new Twig_Environment($loader, $options);
$twig->addExtension(new Twig_Extensions_Extension_I18n()); $twig->addExtension(new Twig_Extensions_Extension_I18n());
$twig->addFunction(new TwigFunction('moduleURL', [Module::class, 'getModuleURL']));
// initialize some basic context // initialize some basic context
$langParam = $this->configuration->getString('language.parameter.name', 'language'); $langParam = $this->configuration->getString('language.parameter.name', 'language');
$twig->addGlobal('languageParameterName', $langParam); $twig->addGlobal('languageParameterName', $langParam);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment