Alter links in the active trail before it is rendered as the breadcrumb.
This hook is invoked by menu_get_active_breadcrumb() and allows alteration of the breadcrumb links for the current page, which may be preferred instead of setting a custom breadcrumb via drupal_set_breadcrumb().
Implementations should take into account that menu_get_active_breadcrumb() subsequently performs the following adjustments to the active trail *after* this hook has been invoked:
Each link in the active trail must contain:
$active_trail: An array containing breadcrumb links for the current page.
$item: The menu router item of the current page.
function hook_menu_breadcrumb_alter(&$active_trail, $item) {
// Always display a link to the current page by duplicating the last link in
// the active trail. This means that menu_get_active_breadcrumb() will remove
// the last link (for the current page), but since it is added once more here,
// it will appear.
if (!drupal_is_front_page()) {
$end = end($active_trail);
if ($item['href'] == $end['href']) {
$active_trail[] = $end;
}
}
}