mirror of
https://github.com/slawkens/myaac.git
synced 2025-10-14 01:34:55 +02:00
add $params as optional parameter to hook twig function
This commit is contained in:
@@ -90,14 +90,14 @@ $function = new TwigFunction('truncate', function ($s, $n) {
|
||||
});
|
||||
$twig->addFunction($function);
|
||||
|
||||
$function = new TwigFunction('hook', function ($hook) {
|
||||
$function = new TwigFunction('hook', function ($hook, array $params = []) {
|
||||
global $hooks;
|
||||
|
||||
if(is_string($hook)) {
|
||||
$hook = constant($hook);
|
||||
}
|
||||
|
||||
$hooks->trigger($hook);
|
||||
$hooks->trigger($hook, $params);
|
||||
});
|
||||
$twig->addFunction($function);
|
||||
|
||||
|
Reference in New Issue
Block a user