Skip to content
Snippets Groups Projects
Commit d89edb79 authored by Earl Miles's avatar Earl Miles
Browse files

Clean up delegator task handler edit breadcrumbs so they are actually usable.

parent 25b0bc65
No related branches found
No related tags found
No related merge requests found
...@@ -40,15 +40,28 @@ function delegator_set_trail($task, $task_name = NULL) { ...@@ -40,15 +40,28 @@ function delegator_set_trail($task, $task_name = NULL) {
return; return;
} }
ctools_include('menu'); ctools_include('menu');
$trail = menu_get_active_trail(); $trail = menu_get_active_trail();
$remove = ctools_get_menu_trail('admin/build/delegator'); $remove = ctools_get_menu_trail('admin/build/delegator');
foreach ($remove as $id => $info) { foreach ($remove as $info) {
if (isset($trail[$id])) { foreach ($trail as $id => $crumb) {
unset($trail[$id]); if ($crumb['href'] == $info['href']) {
unset($trail[$id]);
}
} }
} }
if ($task_name) {
// Clean up broken 'Edit' link that Drupal leaves behind.
$trail = array_values($trail);
if (isset($trail[0]) && $trail[0]['title'] == t('Edit')) {
unset($trail[0]);
}
array_unshift($trail, menu_get_item('admin/build/delegator/' . $task_name));
}
$trail = array_merge(ctools_get_menu_trail($task_type['admin path']), $trail); $trail = array_merge(ctools_get_menu_trail($task_type['admin path']), $trail);
menu_set_active_trail($trail); menu_set_active_trail($trail);
} }
...@@ -1001,7 +1014,7 @@ function delegator_administer_task_handler_export($task_name, $name) { ...@@ -1001,7 +1014,7 @@ function delegator_administer_task_handler_export($task_name, $name) {
drupal_set_title(t('Export task handler "@title"', array('@title' => $title))); drupal_set_title(t('Export task handler "@title"', array('@title' => $title)));
ctools_include('export'); ctools_include('export');
delegator_set_trail($task); delegator_set_trail($task, $task_name);
return drupal_get_form('ctools_export_form', delegator_export_task_handler($handler), $title); return drupal_get_form('ctools_export_form', delegator_export_task_handler($handler), $title);
} }
...@@ -1064,7 +1077,7 @@ function delegator_administer_task_handler_edit($task_name, $handler_id, $name, ...@@ -1064,7 +1077,7 @@ function delegator_administer_task_handler_edit($task_name, $handler_id, $name,
$title = delegator_get_handler_title($plugin, $handler, $task, $subtask_id); $title = delegator_get_handler_title($plugin, $handler, $task, $subtask_id);
drupal_set_title(t('Edit task handler "@title"', array('@title' => $title))); drupal_set_title(t('Edit task handler "@title"', array('@title' => $title)));
delegator_set_trail($task); delegator_set_trail($task, $task_name);
$form_state = array( $form_state = array(
'step' => $step, 'step' => $step,
'task_name' => $task_name, 'task_name' => $task_name,
...@@ -1250,7 +1263,7 @@ function delegator_administer_break_lock(&$form_state, $task_name) { ...@@ -1250,7 +1263,7 @@ function delegator_administer_break_lock(&$form_state, $task_name) {
$form = array(); $form = array();
$task = delegator_get_task($task_id); $task = delegator_get_task($task_id);
delegator_set_trail($task); delegator_set_trail($task, $task_name);
// @todo put task title here, but also needs subtask support. // @todo put task title here, but also needs subtask support.
if (empty($lock)) { if (empty($lock)) {
......
...@@ -76,27 +76,6 @@ function delegator_ctools_plugin_directory($module, $plugin) { ...@@ -76,27 +76,6 @@ function delegator_ctools_plugin_directory($module, $plugin) {
function delegator_menu() { function delegator_menu() {
$items = array(); $items = array();
// Set up our own menu items here.
// @todo -- this is more or less deprecated now, but we need to change
// the import function so that it can import on a per task basis.
/*
$items['admin/build/delegator'] = array(
'title' => 'Delegator',
'description' => 'Assign handlers to tasks such as node overrides',
'position' => 'right',
'page callback' => 'system_admin_menu_block_page',
'access arguments' => array('administer delegator'),
'file' => 'system.admin.inc',
'file path' => drupal_get_path('module', 'system'),
);
$items['admin/build/delegator/list'] = array(
'title' => 'Tasks',
'type' => MENU_DEFAULT_LOCAL_TASK,
'weight' => -10,
);
*/
// Task types get menu entries so they can set up their own administrative // Task types get menu entries so they can set up their own administrative
// areas. // areas.
$task_types = delegator_get_task_types(); $task_types = delegator_get_task_types();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment