You are here

function quickbar_in_active_trail in Quickbar 7

Same name and namespace in other branches
  1. 6 quickbar.module \quickbar_in_active_trail()
  2. 7.2 quickbar.module \quickbar_in_active_trail()

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.

2 calls to quickbar_in_active_trail()
quickbar_menu_navigation_links in ./quickbar.module
Generate a links array from a menu tree array.
quickbar_preprocess_quickbar in theme/theme.inc
Preprocessor for theme('quickbar').

File

./quickbar.module, line 369

Code

function quickbar_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);
}