You are here

function admin_in_active_trail in Admin 6

Checks whether an item is in the active trail. Useful when using a menu generated by menu_tree_all_data() which does not set the 'in_active_trail' flag on items.

3 calls to admin_in_active_trail()
admin_menu_navigation_links in ./admin.module
Generate a links array from a menu tree array.
admin_navigation_secondary in ./admin.module
Generate the 2nd level of navigation links under 'admin/*'.
admin_preprocess_admin_toolbar in toolbar/theme.inc
Preprocessor for theme('admin_toolbar').

File

./admin.module, line 562

Code

function admin_in_active_trail($path, $reset = FALSE) {

  // Gather active paths
  static $active_paths;
  if (!isset($active_paths) || $reset) {
    $active_paths = array();
    $trail = menu_get_active_trail();
    foreach ($trail as $item) {
      if (!empty($item['href'])) {
        $active_paths[] = $item['href'];
      }
    }
  }
  return in_array($path, $active_paths);
}