diff --git a/system/twig.php b/system/twig.php index 65e6ded0..4fc7c5ec 100644 --- a/system/twig.php +++ b/system/twig.php @@ -90,15 +90,16 @@ $function = new TwigFunction('truncate', function ($s, $n) { }); $twig->addFunction($function); -$function = new TwigFunction('hook', function ($hook, array $params = []) { +$function = new TwigFunction('hook', function ($context, $hook, array $params = []) { global $hooks; if(is_string($hook)) { $hook = constant($hook); } + $params['context'] = $context; $hooks->trigger($hook, $params); -}); +}, ['needs_context' => true]); $twig->addFunction($function); $function = new TwigFunction('config', function ($key) {