mirror of
https://github.com/slawkens/myaac.git
synced 2025-04-27 01:39:22 +02:00
Allow string to be passed to hook twig function
This commit is contained in:
parent
071289bc48
commit
f886245e3c
@ -38,6 +38,11 @@ $twig->addFunction($function);
|
|||||||
|
|
||||||
$function = new Twig_SimpleFunction('hook', function ($hook) {
|
$function = new Twig_SimpleFunction('hook', function ($hook) {
|
||||||
global $hooks;
|
global $hooks;
|
||||||
|
|
||||||
|
if(is_string($hook)) {
|
||||||
|
$hook = constant($hook);
|
||||||
|
}
|
||||||
|
|
||||||
$hooks->trigger($hook);
|
$hooks->trigger($hook);
|
||||||
});
|
});
|
||||||
$twig->addFunction($function);
|
$twig->addFunction($function);
|
||||||
@ -51,4 +56,4 @@ $filter = new Twig_SimpleFilter('urlencode', function ($s) {
|
|||||||
return urlencode($s);
|
return urlencode($s);
|
||||||
});
|
});
|
||||||
$twig->addFilter($filter);
|
$twig->addFilter($filter);
|
||||||
unset($function, $filter);
|
unset($function, $filter);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user