projects
/
civicrm-core.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Cleanup uses of CRM_Utils_Array::value related to numbers
[civicrm-core.git]
/
CRM
/
Core
/
Menu.php
diff --git
a/CRM/Core/Menu.php
b/CRM/Core/Menu.php
index ceb7e2a98cdf98e1a5b18f8247b46d19d9de948b..20593b0b286eacfaf5295488df5986633393d1eb 100644
(file)
--- 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) {
* @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);
}
self::readXML($xml, $menu);
}
@@
-227,9
+227,10
@@
class CRM_Core_Menu {
foreach ($fieldsToPropagate as $field) {
if (!$fieldsPresent[$field]) {
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;
$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'],
$value = array(
'title' => $item['title'],
- 'desc' =>
CRM_Utils_Array::value('desc', $item)
,
+ 'desc' =>
$item['desc'] ?? NULL
,
'id' => strtr($item['title'], array(
'(' => '_',
')' => '',
'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
),
// 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();
}
);
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'];
}
$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
/**
* @param $menu
* @param $path
+ *
+ * @throws \CRM_Core_Exception
*/
public static function fillComponentIds(&$menu, $path) {
static $cache = array();
*/
public static function fillComponentIds(&$menu, $path) {
static $cache = array();
@@
-524,7
+526,7
@@
class CRM_Core_Menu {
$menu[$path]['component_id'] = $cache[$compPath];
}
else {
$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'
$componentId = CRM_Core_DAO::getFieldValue('CRM_Core_DAO_Component',
$menu[$compPath]['component'],
'id', 'name'