From f886245e3c75c4f9cdbf3e9bf550b93fd5003b03 Mon Sep 17 00:00:00 2001 From: slawkens Date: Mon, 10 Feb 2020 22:42:02 +0100 Subject: [PATCH] Allow string to be passed to hook twig function --- system/twig.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/system/twig.php b/system/twig.php index 34e65a2d..8d8790d3 100644 --- a/system/twig.php +++ b/system/twig.php @@ -38,6 +38,11 @@ $twig->addFunction($function); $function = new Twig_SimpleFunction('hook', function ($hook) { global $hooks; + + if(is_string($hook)) { + $hook = constant($hook); + } + $hooks->trigger($hook); }); $twig->addFunction($function); @@ -51,4 +56,4 @@ $filter = new Twig_SimpleFilter('urlencode', function ($s) { return urlencode($s); }); $twig->addFilter($filter); -unset($function, $filter); \ No newline at end of file +unset($function, $filter);