From 57bd5be4abb4bdf0c234b7a4fcd4e74e33a8d78c Mon Sep 17 00:00:00 2001 From: Joel Brock Date: Tue, 9 Jun 2026 17:14:54 -0700 Subject: [PATCH] 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. --- civi-extension/webform-mw/webform_mw.php | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/civi-extension/webform-mw/webform_mw.php b/civi-extension/webform-mw/webform_mw.php index 454a282..6617859 100644 --- a/civi-extension/webform-mw/webform_mw.php +++ b/civi-extension/webform-mw/webform_mw.php @@ -37,6 +37,19 @@ function _webform_mw_staff_key(): string { 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(). *