I'm writing a very simple module to alter the active trail on specific pages. Observe.
function alter_breadcrumbs_menu_breadcrumb_alter(&$active_trail, $item) {
if (substr($item['href'], 0, 4) == 'user') {
$num_crumbs = count($active_trail);
$people = array(
'href' => 'people',
'title' => t('People'),
'localized_options' => array(),
);
$active_trail[] = $people;
}
}
The profile page by default has the breadcrumb 'Home'. I have a directory page that has a list of users with links to their profile pages. This page is located under /people. So, on the user page, I want the breadcrumbs to look like 'Home > People > John Smith'.
I expect the code above to produce 'Home > People', but it doesn't. Instead, it produces 'Home > jsmith > People'. It puts in jsmith instead of John Smith because John Smith is derived from custom first and last name fields, but the crumbs currently just take the user's username by default, so ignore that fact for now. What it comes down to is I don't understand why it's pushing on the username crumb and the People crumb, rather than just the People crumb. Any insight would be helpful.
Cheers.