mirror of
https://github.com/slawkens/myaac.git
synced 2025-04-29 18:59:21 +02:00
Patching from develop - twig context for hooks
This commit is contained in:
parent
0139e4b446
commit
57643bb4aa
@ -90,15 +90,16 @@ $function = new TwigFunction('truncate', function ($s, $n) {
|
|||||||
});
|
});
|
||||||
$twig->addFunction($function);
|
$twig->addFunction($function);
|
||||||
|
|
||||||
$function = new TwigFunction('hook', function ($hook, array $params = []) {
|
$function = new TwigFunction('hook', function ($context, $hook, array $params = []) {
|
||||||
global $hooks;
|
global $hooks;
|
||||||
|
|
||||||
if(is_string($hook)) {
|
if(is_string($hook)) {
|
||||||
$hook = constant($hook);
|
$hook = constant($hook);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$params['context'] = $context;
|
||||||
$hooks->trigger($hook, $params);
|
$hooks->trigger($hook, $params);
|
||||||
});
|
}, ['needs_context' => true]);
|
||||||
$twig->addFunction($function);
|
$twig->addFunction($function);
|
||||||
|
|
||||||
$function = new TwigFunction('config', function ($key) {
|
$function = new TwigFunction('config', function ($key) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user