From 4d194176b178156aee8ee1392cb97b48e678d561 Mon Sep 17 00:00:00 2001 From: Joel Brock Date: Tue, 9 Jun 2026 13:32:24 -0700 Subject: [PATCH] Civi extension: register xml/Menu via hook_civicrm_xmlMenu MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The Engagement Report tab on Organization contact pages was loading the contact-view summary recursively inside its own tab pane. Root cause: Civi's menu router was not picking up the extension's xml/Menu file, so `civicrm/contact/view/engagement-report` fell back to the parent `civicrm/contact/view` route. Adding an explicit hook_civicrm_xmlMenu implementation forces the menu file to register, after which the route resolves to CRM_WebformMw_Page_Tab and the iframe renders as intended. Deploy: replace the extension files on the Civi server, then in Administer → System Settings → Extensions Disable + re-Enable webform-mw (or run `cv flush` on the server) so the menu cache is rebuilt. --- civi-extension/webform-mw/webform_mw.php | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/civi-extension/webform-mw/webform_mw.php b/civi-extension/webform-mw/webform_mw.php index b6a38ea..454a282 100644 --- a/civi-extension/webform-mw/webform_mw.php +++ b/civi-extension/webform-mw/webform_mw.php @@ -37,6 +37,20 @@ function _webform_mw_staff_key(): string { return is_string($env) ? $env : ''; } +/** + * Implements hook_civicrm_xmlMenu(). + * + * Registers this extension's menu file. Civi 5.50+ usually auto-discovers + * `xml/Menu/*.xml` from extensions, but some installations only pick the + * file up when an explicit hook returns it. Without this the new path + * `civicrm/contact/view/engagement-report` falls back to the parent + * `civicrm/contact/view` route and the tab pane recursively embeds the + * contact-view summary instead of our iframe. + */ +function webform_mw_civicrm_xmlMenu(&$files) { + $files[] = __DIR__ . '/xml/Menu/webform_mw.xml'; +} + /** * Implements hook_civicrm_tabset(). *