mirror of
https://github.com/slawkens/myaac.git
synced 2025-04-26 17:29:21 +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) {
|
||||
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);
|
||||
|
Loading…
x
Reference in New Issue
Block a user