From f1670f4012cc7595433fe0b1937c1f9b15a60b07 Mon Sep 17 00:00:00 2001 From: slawkens Date: Mon, 21 Aug 2023 12:25:53 +0200 Subject: [PATCH] Patching from develop - twig context for hooks --- system/twig.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/system/twig.php b/system/twig.php index ee73f14fa1..bc84300184 100644 --- a/system/twig.php +++ b/system/twig.php @@ -44,15 +44,16 @@ }); $twig->addFunction($function); -$function = new TwigFunction('hook', function ($hook) { +$function = new TwigFunction('hook', function ($context, $hook, array $params = []) { global $hooks; if(is_string($hook)) { $hook = constant($hook); } - $hooks->trigger($hook); -}); + $params['context'] = $context; + $hooks->trigger($hook, $params); +}, ['needs_context' => true]); $twig->addFunction($function); $function = new TwigFunction('config', function ($key) {