Issue #2105167 by tim.plunkett: Fixed Legacy local actions are added alongside modern local actions.
parent
ca12914436
commit
aa05c211a7
|
@ -2106,7 +2106,8 @@ function _menu_get_legacy_tasks($router_item, &$data, &$root_path) {
|
||||||
// MENU_IS_LOCAL_ACTION before checking.
|
// MENU_IS_LOCAL_ACTION before checking.
|
||||||
if (($item['type'] & MENU_IS_LOCAL_ACTION) == MENU_IS_LOCAL_ACTION) {
|
if (($item['type'] & MENU_IS_LOCAL_ACTION) == MENU_IS_LOCAL_ACTION) {
|
||||||
// The item is an action, display it as such.
|
// The item is an action, display it as such.
|
||||||
$actions_current[$link['href']] = array(
|
$key = isset($link['route_name']) ? $link['route_name'] : $link['href'];
|
||||||
|
$actions_current[$key] = array(
|
||||||
'#theme' => 'menu_local_action',
|
'#theme' => 'menu_local_action',
|
||||||
'#link' => $link,
|
'#link' => $link,
|
||||||
'#weight' => isset($link['weight']) ? $link['weight'] : NULL,
|
'#weight' => isset($link['weight']) ? $link['weight'] : NULL,
|
||||||
|
@ -2334,8 +2335,7 @@ function menu_get_local_actions() {
|
||||||
$links = menu_local_tasks();
|
$links = menu_local_tasks();
|
||||||
$route_name = Drupal::request()->attributes->get(RouteObjectInterface::ROUTE_NAME);
|
$route_name = Drupal::request()->attributes->get(RouteObjectInterface::ROUTE_NAME);
|
||||||
$manager = \Drupal::service('plugin.manager.menu.local_action');
|
$manager = \Drupal::service('plugin.manager.menu.local_action');
|
||||||
$links['actions'] += $manager->getActionsForRoute($route_name);
|
return $manager->getActionsForRoute($route_name) + $links['actions'];
|
||||||
return $links['actions'];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -37,8 +37,8 @@ class LocalActionTest extends WebTestBase {
|
||||||
$this->drupalGet('menu-test-local-action');
|
$this->drupalGet('menu-test-local-action');
|
||||||
// Ensure that both menu and route based actions are shown.
|
// Ensure that both menu and route based actions are shown.
|
||||||
$this->assertLocalAction(array(
|
$this->assertLocalAction(array(
|
||||||
'menu-test-local-action/dynamic-title' => 'My dynamic-title action',
|
|
||||||
'menu-test-local-action/hook_menu' => 'My hook_menu action',
|
'menu-test-local-action/hook_menu' => 'My hook_menu action',
|
||||||
|
'menu-test-local-action/dynamic-title' => 'My dynamic-title action',
|
||||||
'menu-test-local-action/routing' => 'My YAML discovery action',
|
'menu-test-local-action/routing' => 'My YAML discovery action',
|
||||||
'menu-test-local-action/routing2' => 'Title override',
|
'menu-test-local-action/routing2' => 'Title override',
|
||||||
));
|
));
|
||||||
|
|
Loading…
Reference in New Issue