Same name and namespace in other branches
  1. 4.6.x includes/menu.inc \menu_get_active_breadcrumb()
  2. 4.7.x includes/menu.inc \menu_get_active_breadcrumb()
  3. 5.x includes/menu.inc \menu_get_active_breadcrumb()
  4. 7.x includes/menu.inc \menu_get_active_breadcrumb()

Get the breadcrumb for the current page, as determined by the active trail.

Related topics

1 call to menu_get_active_breadcrumb()
drupal_get_breadcrumb in includes/common.inc
Get the breadcrumb trail for the current page.

File

includes/menu.inc, line 1602
API for the Drupal menu system.

Code

function menu_get_active_breadcrumb() {
  $breadcrumb = array();

  // No breadcrumb for the front page.
  if (drupal_is_front_page()) {
    return $breadcrumb;
  }
  $item = menu_get_item();
  if ($item && $item['access']) {
    $active_trail = menu_get_active_trail();
    foreach ($active_trail as $parent) {
      $breadcrumb[] = l($parent['title'], $parent['href'], $parent['localized_options']);
    }
    $end = end($active_trail);

    // Don't show a link to the current page in the breadcrumb trail.
    if ($item['href'] == $end['href'] || $item['type'] == MENU_DEFAULT_LOCAL_TASK && $end['href'] != '<front>') {
      array_pop($breadcrumb);
    }
  }
  return $breadcrumb;
}