mirror of
https://github.com/slawkens/myaac.git
synced 2025-04-27 17:59:22 +02:00
Patching from develop - twig context for hooks
This commit is contained in:
parent
6fcf0f7117
commit
f1670f4012
@ -44,15 +44,16 @@ $function = new TwigFunction('getGuildLink', function ($s, $p) {
|
|||||||
});
|
});
|
||||||
$twig->addFunction($function);
|
$twig->addFunction($function);
|
||||||
|
|
||||||
$function = new TwigFunction('hook', function ($hook) {
|
$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);
|
||||||
}
|
}
|
||||||
|
|
||||||
$hooks->trigger($hook);
|
$params['context'] = $context;
|
||||||
});
|
$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