Allow string to be passed to hook twig function

This commit is contained in:
slawkens 2020-02-10 22:42:02 +01:00
parent 071289bc48
commit f886245e3c

View File

@ -38,6 +38,11 @@ $twig->addFunction($function);
$function = new Twig_SimpleFunction('hook', function ($hook) {
global $hooks;
if(is_string($hook)) {
$hook = constant($hook);
}
$hooks->trigger($hook);
});
$twig->addFunction($function);
@ -51,4 +56,4 @@ $filter = new Twig_SimpleFilter('urlencode', function ($s) {
return urlencode($s);
});
$twig->addFilter($filter);
unset($function, $filter);
unset($function, $filter);