Skip to content

Commit

Permalink
Patching from develop - twig context for hooks
Browse files Browse the repository at this point in the history
  • Loading branch information
slawkens committed Aug 21, 2023
1 parent 6fcf0f7 commit f1670f4
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions system/twig.php
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit f1670f4

Please sign in to comment.