Merge pull request #19135 from civicrm/5.33
[civicrm-core.git] / CRM / Core / Menu.php
index bd9900df2f984e7b47e71854520c3e39f6d156f4..390d6a2a7c1b6e113c33836d49f3ca31d8917745 100644 (file)
@@ -74,7 +74,7 @@ class CRM_Core_Menu {
       // lets call a hook and get any additional files if needed
       CRM_Utils_Hook::xmlMenu($files);
 
-      self::$_items = array();
+      self::$_items = [];
       foreach ($files as $file) {
         self::read($file, self::$_items);
       }
@@ -116,13 +116,13 @@ class CRM_Core_Menu {
         throw new CRM_Core_Exception('Unable to read XML file');
       }
       $path = (string ) $item->path;
-      $menu[$path] = array();
+      $menu[$path] = [];
       unset($item->path);
 
       if ($item->ids_arguments) {
-        $ids = array();
+        $ids = [];
         foreach (array('json' => 'json', 'html' => 'html', 'exception' => 'exceptions') as $tag => $attr) {
-          $ids[$attr] = array();
+          $ids[$attr] = [];
           foreach ($item->ids_arguments->{$tag} as $value) {
             $ids[$attr][] = (string) $value;
           }
@@ -154,7 +154,7 @@ class CRM_Core_Menu {
               $elements = explode(';', $value);
               $op = 'or';
             }
-            $items = array();
+            $items = [];
             foreach ($elements as $element) {
               $items[] = $element;
             }
@@ -216,7 +216,7 @@ class CRM_Core_Menu {
       'page_arguments',
       'is_ssl',
     );
-    $fieldsPresent = array();
+    $fieldsPresent = [];
     foreach ($fieldsToPropagate as $field) {
       $fieldsPresent[$field] = isset($menu[$path][$field]);
     }
@@ -307,7 +307,7 @@ class CRM_Core_Menu {
         CRM_Core_BAO_SchemaHandler::checkIfFieldExists('civicrm_menu', 'module_data', FALSE)
       ) {
         // Move unrecognized fields to $module_data.
-        $module_data = array();
+        $module_data = [];
         foreach (array_keys($item) as $key) {
           if (!isset($daoFields[$key])) {
             $module_data[$key] = $item[$key];
@@ -341,7 +341,7 @@ class CRM_Core_Menu {
    * @param array $menu
    */
   public static function buildAdminLinks(&$menu) {
-    $values = array();
+    $values = [];
 
     foreach ($menu as $path => $item) {
       if (empty($item['adminGroup'])) {
@@ -372,8 +372,8 @@ class CRM_Core_Menu {
         'extra' => $item['extra'] ?? NULL,
       );
       if (!array_key_exists($item['adminGroup'], $values)) {
-        $values[$item['adminGroup']] = array();
-        $values[$item['adminGroup']]['fields'] = array();
+        $values[$item['adminGroup']] = [];
+        $values[$item['adminGroup']]['fields'] = [];
       }
       $values[$item['adminGroup']]['fields']["{weight}.{$item['title']}"] = $value;
       $values[$item['adminGroup']]['component_id'] = $item['component_id'];
@@ -416,7 +416,7 @@ class CRM_Core_Menu {
    *   The breadcrumb for this path
    */
   public static function buildBreadcrumb(&$menu, $path) {
-    $crumbs = array();
+    $crumbs = [];
 
     $pathElements = explode('/', $path);
     array_pop($pathElements);
@@ -506,7 +506,7 @@ class CRM_Core_Menu {
    * @throws \CRM_Core_Exception
    */
   public static function fillComponentIds(&$menu, $path) {
-    static $cache = array();
+    static $cache = [];
 
     if (array_key_exists('component_id', $menu[$path])) {
       return;
@@ -551,7 +551,7 @@ class CRM_Core_Menu {
 
     $args = explode('/', $path);
 
-    $elements = array();
+    $elements = [];
     while (!empty($args)) {
       $string = implode('/', $args);
       $string = CRM_Core_DAO::escapeString($string);
@@ -587,10 +587,10 @@ UNION (
     $menu = new CRM_Core_DAO_Menu();
     $menu->query($query);
 
-    self::$_menuCache = array();
+    self::$_menuCache = [];
     $menuPath = NULL;
     while ($menu->fetch()) {
-      self::$_menuCache[$menu->path] = array();
+      self::$_menuCache[$menu->path] = [];
       CRM_Core_DAO::storeValues($menu, self::$_menuCache[$menu->path]);
 
       // Move module_data into main item.
@@ -647,7 +647,7 @@ UNION (
     if (!is_string($pathArgs)) {
       return;
     }
-    $args = array();
+    $args = [];
 
     $elements = explode(',', $pathArgs);
     foreach ($elements as $keyVal) {
@@ -656,7 +656,7 @@ UNION (
     }
 
     if (array_key_exists('urlToSession', $arr)) {
-      $urlToSession = array();
+      $urlToSession = [];
 
       $params = explode(';', $arr['urlToSession']);
       $count = 0;