Merge pull request #2015 from fabrixxm/template_vars_hook

Add 'template_vars' hook
This commit is contained in:
Tobias Diekershoff 2015-11-06 19:39:42 +01:00
commit 1053fe91c8
2 changed files with 29 additions and 19 deletions

View file

@ -271,6 +271,12 @@ $b is an array, params to mail()
is called after the navigational menu is build in include/nav.php. is called after the navigational menu is build in include/nav.php.
$b is an array containing $nav from nav.php. $b is an array containing $nav from nav.php.
###'template_vars'
is called before vars are passed to the template engine to render the page.
The registered function can add,change or remove variables passed to template.
$b is the array of vars pased to 'replace_macros()' function.
Complete list of hook callbacks Complete list of hook callbacks
--- ---

View file

@ -19,6 +19,10 @@ function replace_macros($s,$r) {
$stamp1 = microtime(true); $stamp1 = microtime(true);
// "middleware": inject variables into templates
call_hooks("template_vars", $r);
$a = get_app(); $a = get_app();
$t = $a->template_engine(); $t = $a->template_engine();