function _entityqueue_set_breadcrumb in Entityqueue 7
Workaround for missing breadcrumbs on callback and action paths.
Shamelessly stolen from http://drupal.org/project/xmlsitemap
@todo Remove when http://drupal.org/node/576290 is fixed.
4 calls to _entityqueue_set_breadcrumb()
- entityqueue_export_ui::subqueues_page in plugins/
ctools/ export_ui/ entityqueue_export_ui.class.php - Page callback; Displays a listing of subqueues for a queue.
- entityqueue_export_ui::subqueue_delete_page in plugins/
ctools/ export_ui/ entityqueue_export_ui.class.php - Page callback; Displays the subqueue delete form.
- entityqueue_export_ui::subqueue_edit_page in plugins/
ctools/ export_ui/ entityqueue_export_ui.class.php - Page callback; Displays the subqueue edit form.
- entityqueue_export_ui_form in plugins/
ctools/ export_ui/ entityqueue_export_ui.inc - Form to edit the settings of a queue.
File
- ./
entityqueue.module, line 1248 - Allows users to collect entities in arbitrarily ordered lists.
Code
function _entityqueue_set_breadcrumb($path = 'admin/structure/entityqueue/list') {
$breadcrumb = array();
$path = explode('/', $path);
do {
$menu_path = implode('/', $path);
$menu_item = menu_get_item($menu_path);
// Skip default tabs such as the "list" page, which is the same as it's parent.
if ($menu_item['type'] == MENU_DEFAULT_LOCAL_TASK) {
continue;
}
$last_item = isset($menu_item['map']) ? end($menu_item['map']) : NULL;
if (is_object($last_item) && method_exists($last_item, 'label')) {
$menu_item['title'] = $last_item
->label();
}
if (isset($last_item)) {
array_unshift($breadcrumb, l($menu_item['title'], $menu_path));
}
else {
array_unshift($breadcrumb, $menu_item['title']);
}
} while (array_pop($path) && !empty($path));
array_unshift($breadcrumb, l(t('Home'), NULL));
array_pop($breadcrumb);
drupal_set_breadcrumb($breadcrumb);
}