function units_ui_menu_breadcrumb_alter in Units of Measurement 7
Same name and namespace in other branches
- 7.2 units_ui.module \units_ui_menu_breadcrumb_alter()
Implements hook_menu_breadcrumb_alter().
File
- ./
units_ui.module, line 80 - Provide UI for managing available units and conversions between them.
Code
function units_ui_menu_breadcrumb_alter(&$active_trail, $item) {
// We want to embed the link to unit measures overview page on all pages that
// are related to managements of units.
$prefix = 'units-ui/';
$tail = array();
$active_trail = array_reverse($active_trail);
foreach ($active_trail as $k => $trail) {
if (drupal_substr($trail['href'], 0, drupal_strlen($prefix)) == $prefix) {
$tail[] = $trail;
unset($active_trail[$k]);
}
else {
break;
}
}
$active_trail = array_reverse($active_trail);
if (drupal_substr($item['path'], 0, drupal_strlen($prefix)) == $prefix) {
$measure_entity_info = entity_get_info('units_measure');
$active_trail[] = menu_get_item($measure_entity_info['admin ui']['path']);
}
$active_trail = array_merge($active_trail, array_reverse($tail));
}