* Are we in print mode? if so we need to modify the display
* functionality to do a minimal display :)
*
- * @var bool
+ * @var int|string
+ * Should match a CRM_Core_Smarty::PRINT_* constant,
+ * or equal 0 if not in print mode
*/
protected $_print = FALSE;
// Required for footer.tpl,
// See ExampleHookTest:testPageOutput.
'footer_status_severity',
+ // in 'body.tpl
+ 'suppressForm',
+ 'beginHookFormElements',
];
/**
$pageTemplateFile = $this->getHookedTemplateFileName();
self::$_template->assign('tplFile', $pageTemplateFile);
+ self::$_template->addExpectedTabHeaderKeys();
+
// invoke the pagRun hook, CRM-3906
CRM_Utils_Hook::pageRun($this);
//its time to call the hook.
CRM_Utils_Hook::alterContent($content, 'page', $pageTemplateFile, $this);
- if ($this->_print == CRM_Core_Smarty::PRINT_PDF) {
+ if ($this->_print === CRM_Core_Smarty::PRINT_PDF) {
CRM_Utils_PDF_Utils::html2pdf($content, "{$this->_name}.pdf", FALSE);
}
- elseif ($this->_print == CRM_Core_Smarty::PRINT_JSON) {
+ elseif ($this->_print === CRM_Core_Smarty::PRINT_JSON) {
$this->ajaxResponse['content'] = $content;
CRM_Core_Page_AJAX::returnJsonResponse($this->ajaxResponse);
}
/**
* Setter for print.
*
- * @param bool $print
+ * @param int|string $print
+ * Should match a CRM_Core_Smarty::PRINT_* constant,
+ * or equal 0 if not in print mode
+ *
+ * @return void
*/
public function setPrint($print) {
$this->_print = $print;
/**
* Getter for print.
*
- * @return bool
- * return the print value
+ * @return int|string
+ * Value matching a CRM_Core_Smarty::PRINT_* constant,
+ * or 0 if not in print mode
*/
public function getPrint() {
return $this->_print;
return "<i$attribString></i>$sr";
}
+ /**
+ * Add an expected smarty variable to the array.
+ *
+ * @param string $elementName
+ */
+ public function addExpectedSmartyVariable(string $elementName): void {
+ $this->expectedSmartyVariables[] = $elementName;
+ }
+
+ /**
+ * Add an expected smarty variable to the array.
+ *
+ * @param array $elementNames
+ */
+ public function addExpectedSmartyVariables(array $elementNames): void {
+ foreach ($elementNames as $elementName) {
+ // Duplicates don't actually matter....
+ $this->addExpectedSmartyVariable($elementName);
+ }
+ }
+
}