// 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);
}
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;
}
$elements = explode(';', $value);
$op = 'or';
}
- $items = array();
+ $items = [];
foreach ($elements as $element) {
$items[] = $element;
}
'page_arguments',
'is_ssl',
);
- $fieldsPresent = array();
+ $fieldsPresent = [];
foreach ($fieldsToPropagate as $field) {
$fieldsPresent[$field] = isset($menu[$path][$field]);
}
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];
* @param array $menu
*/
public static function buildAdminLinks(&$menu) {
- $values = array();
+ $values = [];
foreach ($menu as $path => $item) {
if (empty($item['adminGroup'])) {
'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'];
* The breadcrumb for this path
*/
public static function buildBreadcrumb(&$menu, $path) {
- $crumbs = array();
+ $crumbs = [];
$pathElements = explode('/', $path);
array_pop($pathElements);
* @throws \CRM_Core_Exception
*/
public static function fillComponentIds(&$menu, $path) {
- static $cache = array();
+ static $cache = [];
if (array_key_exists('component_id', $menu[$path])) {
return;
$args = explode('/', $path);
- $elements = array();
+ $elements = [];
while (!empty($args)) {
$string = implode('/', $args);
$string = CRM_Core_DAO::escapeString($string);
$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.
if (!is_string($pathArgs)) {
return;
}
- $args = array();
+ $args = [];
$elements = explode(',', $pathArgs);
foreach ($elements as $keyVal) {
}
if (array_key_exists('urlToSession', $arr)) {
- $urlToSession = array();
+ $urlToSession = [];
$params = explode(';', $arr['urlToSession']);
$count = 0;