Civi extension: register templates/ dir via hook_civicrm_config

The Engagement Report tab page renders templates/CRM/WebformMw/Page/Tab.tpl
via Smarty. Without an explicit template-dir registration, Smarty cannot
locate the file and the tab fails to render. Use CRM_Core_Smarty's
prependTemplateDir() (cleaner than splicing template_dir by hand).

Mirrors the same fix the CiviCRM admin applied on the server so the repo
source no longer drifts from the working deployed state.
This commit is contained in:
Joel Brock
2026-06-09 17:14:54 -07:00
parent 1364917ada
commit 57bd5be4ab
+13
View File
@@ -37,6 +37,19 @@ function _webform_mw_staff_key(): string {
return is_string($env) ? $env : ''; return is_string($env) ? $env : '';
} }
/**
* Implements hook_civicrm_config().
*
* Registers this extension's `templates/` directory with Smarty so the
* Engagement Report tab page can locate `CRM/WebformMw/Page/Tab.tpl`.
* Without this hook the page callback runs but Smarty has no idea where
* the template lives.
*/
function webform_mw_civicrm_config(&$config) {
$template = CRM_Core_Smarty::singleton();
$template->prependTemplateDir(__DIR__ . '/templates');
}
/** /**
* Implements hook_civicrm_xmlMenu(). * Implements hook_civicrm_xmlMenu().
* *