1. drupal
    1. 6
    2. 8
    3. 7
6 – 8 menu_get_active_trail()

Gets the active trail (path to root menu root) of the current page.

If a trail is supplied to menu_set_active_trail(), that value is returned. If a trail is not supplied to menu_set_active_trail(), the path to the current page is calculated and returned. The calculated trail is also saved as a static value for use by subsequent calls to menu_get_active_trail().

Return value

Path to menu root of the current page, as an array of menu link items, starting with the site's home page. Each link item is an associative array with the following components:

  • title: Title of the item.
  • href: Drupal path of the item.
  • localized_options: Options for passing into the l() function.
  • type: A menu type constant, such as MENU_DEFAULT_LOCAL_TASK, or 0 to indicate it's not really in the menu (used for the home page item).

Related topics

▾ 3 functions call menu_get_active_trail()

menu_get_active_breadcrumb in includes/
Get the breadcrumb for the current page, as determined by the active trail.
menu_get_active_title in includes/
Get the title of the current page, as determined by the active trail.
toolbar_in_active_trail in modules/toolbar/toolbar.module
Checks whether an item is in the active trail.


includes/, line 2473

function menu_get_active_trail() {
  return menu_set_active_trail();