function _farm_ui_menu_breadcrumb_alter in farmOS 7
Helper function for altering the breadcrumb.
1 call to _farm_ui_menu_breadcrumb_alter()
- farm_ui_menu_breadcrumb_alter in modules/
farm/ farm_ui/ farm_ui.module - Implements hook_menu_breadcrumb_alter().
File
- modules/
farm/ farm_ui/ farm_ui.breadcrumb.inc, line 9
Code
function _farm_ui_menu_breadcrumb_alter(&$active_trail, $item) {
// If the current path is the front page, and there are more than 2 items:
$front = variable_get('site_frontpage', 'farm');
if (strpos($item['path'], $front) === 0 && count($active_trail) > 2) {
// If a link to the front page already exists in the second position, bail.
if (!empty($active_trail[1]['link_path']) && $active_trail[1]['link_path'] == $front) {
return;
}
// Add an item for the front page.
$start = array_shift($active_trail);
$front_item = menu_get_item($front);
array_unshift($active_trail, $front_item);
array_unshift($active_trail, $start);
}
}