Defensive code for the case when addon_hooks key does not exist

pull/615/head
Pascal Deklerck 2018-06-13 21:57:59 +02:00
parent d48f0010dd
commit 7ef81f909f
1 changed files with 6 additions and 1 deletions

View File

@ -27,7 +27,12 @@ function mathjax_uninstall() {
Addon::unregisterHook('template_vars', 'addon/mathjax/mathjax.php', 'mathjax_template_vars');
}
function mathjax_template_vars($a, &$arr) {
function mathjax_template_vars($a, &$arr)
{
if (!array_key_exists('addon_hooks',$arr['vars']))
{
$arr['vars']['addon_hooks'] = array();
}
$arr['vars']['addon_hooks'][] = "mathjax";
}