@@ 47-54 (lines=8) @@ | ||
44 | new TwigFunction('has_errors', [$this, 'hasErrors']), |
|
45 | new TwigFunction('active_menus', [$this, 'getActiveMenus']), |
|
46 | new TwigFunction('class_categories_as_json', [$this, 'getClassCategoriesAsJson']), |
|
47 | new TwigFunction('php_*', function () { |
|
48 | $arg_list = func_get_args(); |
|
49 | $function = array_shift($arg_list); |
|
50 | if (is_callable($function)) { |
|
51 | return call_user_func_array($function, $arg_list); |
|
52 | } |
|
53 | trigger_error('Called to an undefined function : php_'.$function, E_USER_WARNING); |
|
54 | }, ['pre_escape' => 'html', 'is_safe' => ['html']]), |
|
55 | ]; |
|
56 | } |
|
57 | ||
@@ 212-224 (lines=13) @@ | ||
209 | * |
|
210 | * @return mixed|null |
|
211 | */ |
|
212 | public function getPhpFunctions() |
|
213 | { |
|
214 | $arg_list = func_get_args(); |
|
215 | $function = array_shift($arg_list); |
|
216 | ||
217 | if (is_callable($function)) { |
|
218 | return call_user_func_array($function, $arg_list); |
|
219 | } |
|
220 | ||
221 | trigger_error('Called to an undefined function : php_'.$function, E_USER_WARNING); |
|
222 | ||
223 | return null; |
|
224 | } |
|
225 | ||
226 | /** |
|
227 | * Get the ClassCategories as JSON. |