From bc537a0c29ff3b764161766307084c7a596a20b2 Mon Sep 17 00:00:00 2001 From: eileen Date: Sat, 30 Jan 2021 14:11:29 +1300 Subject: [PATCH] dev/core#2340 Skip rather than fail on bad menu item --- CRM/Core/Menu.php | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/CRM/Core/Menu.php b/CRM/Core/Menu.php index 390d6a2a7c..a25a8e39cb 100644 --- a/CRM/Core/Menu.php +++ b/CRM/Core/Menu.php @@ -265,14 +265,19 @@ class CRM_Core_Menu { */ public static function build(&$menu) { foreach ($menu as $path => $menuItems) { - self::buildBreadcrumb($menu, $path); - self::fillMenuValues($menu, $path); - self::fillComponentIds($menu, $path); - self::buildReturnUrl($menu, $path); - - // add add page_type if not present - if (!isset($menu[$path]['page_type'])) { - $menu[$path]['page_type'] = 0; + try { + self::buildBreadcrumb($menu, $path); + self::fillMenuValues($menu, $path); + self::fillComponentIds($menu, $path); + self::buildReturnUrl($menu, $path); + + // add add page_type if not present + if (!isset($menu[$path]['page_type'])) { + $menu[$path]['page_type'] = 0; + } + } + catch (CRM_Core_Exception $e) { + Civi::log()->error('Menu path skipped:' . $e->getMessage()); } } @@ -465,7 +470,7 @@ class CRM_Core_Menu { */ public static function buildReturnUrl(&$menu, $path) { if (!isset($menu[$path]['return_url'])) { - list($menu[$path]['return_url'], $menu[$path]['return_url_args']) = self::getReturnUrl($menu, $path); + [$menu[$path]['return_url'], $menu[$path]['return_url_args']] = self::getReturnUrl($menu, $path); } } -- 2.25.1