diff --git a/core/modules/system/src/Tests/Menu/LocalActionTest.php b/core/modules/system/src/Tests/Menu/LocalActionTest.php index 40dc744..d53386f 100644 --- a/core/modules/system/src/Tests/Menu/LocalActionTest.php +++ b/core/modules/system/src/Tests/Menu/LocalActionTest.php @@ -46,6 +46,7 @@ public function testLocalAction() { // Test a local action title that changes based on a config value. $this->drupalGet(Url::fromRoute('menu_test.local_action6')); $this->assertLocalAction([ + [Url::fromRoute('menu_test.local_action2'), 'Dynamic title override'], [Url::fromRoute('menu_test.local_action5'), 'Original title'], ]); // Verify the expected cache tag in the response headers. @@ -57,6 +58,7 @@ public function testLocalAction() { $config->save(); $this->drupalGet(Url::fromRoute('menu_test.local_action6')); $this->assertLocalAction([ + [Url::fromRoute('menu_test.local_action2'), 'Dynamic title override'], [Url::fromRoute('menu_test.local_action5'), 'New title'], ]); } diff --git a/core/modules/system/tests/modules/menu_test/menu_test.links.action.yml b/core/modules/system/tests/modules/menu_test/menu_test.links.action.yml index 3d90eb3..6d903f4 100644 --- a/core/modules/system/tests/modules/menu_test/menu_test.links.action.yml +++ b/core/modules/system/tests/modules/menu_test/menu_test.links.action.yml @@ -25,6 +25,7 @@ menu_test.local_action2: weight: -10 appears_on: - menu_test.local_action1 + - menu_test.local_action6 menu_test.local_action4: route_name: menu_test.local_action4 diff --git a/core/modules/system/tests/modules/menu_test/menu_test.module b/core/modules/system/tests/modules/menu_test/menu_test.module index f891fce..f9aa764 100644 --- a/core/modules/system/tests/modules/menu_test/menu_test.module +++ b/core/modules/system/tests/modules/menu_test/menu_test.module @@ -53,6 +53,16 @@ function menu_test_menu_local_tasks_alter(&$data, $route_name, RefinableCacheabl } /** + * Implements hook_local_actions_alter(). + */ +function menu_test_local_actions_alter(array &$data, $route_appears) { + // Change the link title for local_action2 if on test route 6. + if ($route_appears === 'menu_test.local_action6') { + $data['menu_test.local_action2']['#link']['title'] = 'Dynamic title override'; + } +} + +/** * Sets a static variable for the testMenuName() test. * * Used to change the menu_name parameter of a menu.