_menu_get_active_trail

Versions
4.6 – 5
_menu_get_active_trail()

Returns an array with the menu items that lead to the current menu item.

▾ 2 functions call _menu_get_active_trail()

menu_get_active_breadcrumb in includes/menu.inc
Returns an array of rendered menu items in the active breadcrumb trail.
menu_in_active_trail in includes/menu.inc
Returns true when the menu item is in the active trail.

Code

includes/menu.inc, line 712

<?php
function _menu_get_active_trail() {
  static $trail;

  if (!isset($trail)) {
    $menu = menu_get_menu();

    $trail = array();

    $mid = menu_get_active_item();

    // Follow the parents up the chain to get the trail.
    while ($mid && $menu['items'][$mid]) {
      array_unshift($trail, $mid);
      $mid = $menu['items'][$mid]['pid'];
    }
  }
  return $trail;
}
?>
Login or register to post comments
 
 

All source code and documentation on this site is released under the terms of the GNU General Public License, version 2 and later. Drupal is a registered trademark of Dries Buytaert.