X-Git-Url: https://vcs.fsf.org/?a=blobdiff_plain;f=CRM%2FCore%2FMenu.php;h=20593b0b286eacfaf5295488df5986633393d1eb;hb=2975f0aa78125debe68ee78c336cd8beb2c6e596;hp=ceb7e2a98cdf98e1a5b18f8247b46d19d9de948b;hpb=8de7047a8762a15823f6bd10b94447d3d83937e2;p=civicrm-core.git diff --git a/CRM/Core/Menu.php b/CRM/Core/Menu.php index ceb7e2a98c..20593b0b28 100644 --- a/CRM/Core/Menu.php +++ b/CRM/Core/Menu.php @@ -96,7 +96,7 @@ class CRM_Core_Menu { * @throws Exception */ public static function read($name, &$menu) { - $xml = simplexml_load_file($name); + $xml = simplexml_load_string(file_get_contents($name)); self::readXML($xml, $menu); } @@ -227,9 +227,10 @@ class CRM_Core_Menu { foreach ($fieldsToPropagate as $field) { if (!$fieldsPresent[$field]) { - if (CRM_Utils_Array::value($field, CRM_Utils_Array::value($parentPath, $menu)) !== NULL) { + $fieldInParentMenu = $menu[$parentPath][$field] ?? NULL; + if ($fieldInParentMenu !== NULL) { $fieldsPresent[$field] = TRUE; - $menu[$path][$field] = $menu[$parentPath][$field]; + $menu[$path][$field] = $fieldInParentMenu; } } } @@ -349,7 +350,7 @@ class CRM_Core_Menu { $value = array( 'title' => $item['title'], - 'desc' => CRM_Utils_Array::value('desc', $item), + 'desc' => $item['desc'] ?? NULL, 'id' => strtr($item['title'], array( '(' => '_', ')' => '', @@ -365,14 +366,13 @@ class CRM_Core_Menu { // forceBackend; CRM-14439 work-around; acceptable for now because we don't display breadcrumbs on frontend TRUE ), - 'icon' => CRM_Utils_Array::value('icon', $item), - 'extra' => CRM_Utils_Array::value('extra', $item), + 'icon' => $item['icon'] ?? NULL, + 'extra' => $item['extra'] ?? NULL, ); if (!array_key_exists($item['adminGroup'], $values)) { $values[$item['adminGroup']] = array(); $values[$item['adminGroup']]['fields'] = array(); } - $weight = CRM_Utils_Array::value('weight', $item, 0); $values[$item['adminGroup']]['fields']["{weight}.{$item['title']}"] = $value; $values[$item['adminGroup']]['component_id'] = $item['component_id']; } @@ -501,6 +501,8 @@ class CRM_Core_Menu { /** * @param $menu * @param $path + * + * @throws \CRM_Core_Exception */ public static function fillComponentIds(&$menu, $path) { static $cache = array(); @@ -524,7 +526,7 @@ class CRM_Core_Menu { $menu[$path]['component_id'] = $cache[$compPath]; } else { - if (CRM_Utils_Array::value('component', CRM_Utils_Array::value($compPath, $menu))) { + if (!empty($menu[$compPath]['component'])) { $componentId = CRM_Core_DAO::getFieldValue('CRM_Core_DAO_Component', $menu[$compPath]['component'], 'id', 'name'