// our ensured variables get blown away, so we need to set them even if
// it's already been initialized.
self::$_template->ensureVariablesAreAssigned($this->expectedSmartyVariables);
-
+ self::$_template->addExpectedTabHeaderKeys();
}
/**
$pageTemplateFile = $this->getHookedTemplateFileName();
self::$_template->assign('tplFile', $pageTemplateFile);
+ self::$_template->addExpectedTabHeaderKeys();
+
// invoke the pagRun hook, CRM-3906
CRM_Utils_Hook::pageRun($this);
}
}
+ /**
+ * Avoid e-notices on pages with tabs,
+ * by ensuring tabHeader items contain the necessary keys
+ */
+ public function addExpectedTabHeaderKeys(): void {
+ $defaults = [
+ 'class' => '',
+ 'extra' => '',
+ 'icon' => FALSE,
+ 'count' => FALSE,
+ 'template' => FALSE,
+ ];
+
+ $tabs = $this->get_template_vars('tabHeader');
+ foreach ((array) $tabs as $i => $tab) {
+ $tabs[$i] = array_merge($defaults, $tab);
+ }
+ $this->assign('tabHeader', $tabs);
+ }
+
/**
* Fetch a template (while using certain variables)
*