Add 'template_vars' hook

This commit is contained in:
fabrixxm 2015-11-06 19:33:14 +01:00
parent a687999d42
commit 545a7a80e4
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();