Commit ace3459c authored by alexpott's avatar alexpott

Issue #2006636 by tim.plunkett: Fixed menu_contextual_links() will always...

Issue #2006636 by tim.plunkett: Fixed menu_contextual_links() will always return a link to the MENU_DEFAULT_LOCAL_TASK, never the parent.
parent 75ee363b
......@@ -2202,6 +2202,13 @@ function menu_contextual_links($module, $parent_path, $args) {
if (!$item['access']) {
continue;
}
// If this item is a default local task, rewrite the href to link to its
// parent item.
if ($item['type'] == MENU_DEFAULT_LOCAL_TASK) {
$item['href'] = $item['tab_parent_href'];
}
// All contextual links are keyed by the actual "task" path argument,
// prefixed with the name of the implementing module.
$links[$module . '-' . $key] = $item;
......
......@@ -174,7 +174,7 @@ public function testBlockContextualLinks() {
));
$this->assertResponse(200);
$json = drupal_json_decode($response);
$this->assertIdentical($json[$id], '<ul class="contextual-links"><li class="block-configure odd first"><a href="' . base_path() . 'admin/structure/block/manage/' . $block->id() . '/configure?destination=test-page">Configure block</a></li><li class="views-ui-edit even last"><a href="' . base_path() . 'admin/structure/views/view/test_view_block/edit/block_1?destination=test-page">Edit view</a></li></ul>');
$this->assertIdentical($json[$id], '<ul class="contextual-links"><li class="block-configure odd first"><a href="' . base_path() . 'admin/structure/block/manage/' . $block->id() . '?destination=test-page">Configure block</a></li><li class="views-ui-edit even last"><a href="' . base_path() . 'admin/structure/views/view/test_view_block/edit/block_1?destination=test-page">Edit view</a></li></ul>');
}
}
......@@ -329,7 +329,7 @@ public function testBlockContextualLinks() {
));
$this->assertResponse(200);
$json = drupal_json_decode($response);
$this->assertIdentical($json[$id], '<ul class="contextual-links"><li class="block-configure odd first"><a href="' . base_path() . 'admin/structure/block/manage/' . $block->id() . '/configure?destination=test-page">Configure block</a></li><li class="menu-edit even last"><a href="' . base_path() . 'admin/structure/menu/manage/tools/edit?destination=test-page">Edit menu</a></li></ul>');
$this->assertIdentical($json[$id], '<ul class="contextual-links"><li class="block-configure odd first"><a href="' . base_path() . 'admin/structure/block/manage/' . $block->id() . '?destination=test-page">Configure block</a></li><li class="menu-edit even last"><a href="' . base_path() . 'admin/structure/menu/manage/tools?destination=test-page">Edit menu</a></li></ul>');
}
/**
......
......@@ -349,7 +349,7 @@ function views_ui_contextual_links_view_alter(&$element, $items) {
// screen.
elseif (!empty($element['#links']['views-ui-edit'])) {
$display_id = $element['#contextual_links']['views_ui'][2]['display_id'];
$element['#links']['views-ui-edit']['href'] .= '/' . $display_id;
$element['#links']['views-ui-edit']['href'] .= '/edit/' . $display_id;
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment