Merge pull request #15300 from civicrm/5.18
[civicrm-core.git] / CRM / Core / Menu.php
index 796491120402e5ddfba89dcc2c04d6b1a7f031aa..c6fefdc91a5951343e3edf09bacfff9781cbea00 100644 (file)
@@ -401,120 +401,6 @@ class CRM_Core_Menu {
     $menu['admin'] = array('breadcrumb' => $values);
   }
 
-  /**
-   * Get navigation.
-   *
-   * @param bool $all
-   *
-   * @return mixed
-   * @throws Exception
-   */
-  public static function &getNavigation($all = FALSE) {
-    CRM_Core_Error::fatal();
-
-    if (!self::$_menuCache) {
-      self::get('navigation');
-    }
-
-    if (CRM_Core_Config::isUpgradeMode()) {
-      return array();
-    }
-
-    if (!array_key_exists('navigation', self::$_menuCache)) {
-      // problem could be due to menu table empty. Just do a
-      // menu store and try again
-      self::store();
-
-      // here we goo
-      self::get('navigation');
-      if (!array_key_exists('navigation', self::$_menuCache)) {
-        CRM_Core_Error::fatal();
-      }
-    }
-    $nav = &self::$_menuCache['navigation'];
-
-    if (!$nav ||
-      !isset($nav['breadcrumb'])
-    ) {
-      return NULL;
-    }
-
-    $values = &$nav['breadcrumb'];
-    $config = CRM_Core_Config::singleton();
-    foreach ($values as $index => $item) {
-      if (strpos(CRM_Utils_Array::value($config->userFrameworkURLVar, $_REQUEST),
-          $item['path']
-        ) === 0
-      ) {
-        $values[$index]['active'] = 'class="active"';
-      }
-      else {
-        $values[$index]['active'] = '';
-      }
-
-      if ($values[$index]['parent']) {
-        $parent = $values[$index]['parent'];
-
-        // only reset if still a leaf
-        if ($values[$parent]['class'] == 'leaf') {
-          $values[$parent]['class'] = 'collapsed';
-        }
-
-        // if a child or the parent is active, expand the menu
-        if ($values[$index]['active'] ||
-          $values[$parent]['active']
-        ) {
-          $values[$parent]['class'] = 'expanded';
-        }
-
-        // make the parent inactive if the child is active
-        if ($values[$index]['active'] &&
-          $values[$parent]['active']
-        ) {
-          $values[$parent]['active'] = '';
-        }
-      }
-    }
-
-    if (!$all) {
-      // remove all collapsed menu items from the array
-      foreach ($values as $weight => $v) {
-        if ($v['parent'] &&
-          $values[$v['parent']]['class'] == 'collapsed'
-        ) {
-          unset($values[$weight]);
-        }
-      }
-    }
-
-    // check permissions for the rest
-    $activeChildren = array();
-
-    foreach ($values as $weight => $v) {
-      if (CRM_Core_Permission::checkMenuItem($v)) {
-        if ($v['parent']) {
-          $activeChildren[] = $weight;
-        }
-      }
-      else {
-        unset($values[$weight]);
-      }
-    }
-
-    // add the start / end tags
-    $len = count($activeChildren) - 1;
-    if ($len >= 0) {
-      $values[$activeChildren[0]]['start'] = TRUE;
-      $values[$activeChildren[$len]]['end'] = TRUE;
-    }
-
-    ksort($values, SORT_NUMERIC);
-    $i18n = CRM_Core_I18n::singleton();
-    $i18n->localizeTitles($values);
-
-    return $values;
-  }
-
   /**
    * Get admin links.
    *