diff --git a/core/modules/system/lib/Drupal/system/Tests/Menu/LocalActionTest.php b/core/modules/system/lib/Drupal/system/Tests/Menu/LocalActionTest.php index 43ce3a3..81fe57d 100644 --- a/core/modules/system/lib/Drupal/system/Tests/Menu/LocalActionTest.php +++ b/core/modules/system/lib/Drupal/system/Tests/Menu/LocalActionTest.php @@ -37,6 +37,7 @@ public function testLocalAction() { $this->drupalGet('menu-test-local-action'); // Ensure that both menu and route based actions are shown. $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/routing' => 'My routing action', )); 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 efafe6b..b5c0c47 100644 --- a/core/modules/system/tests/modules/menu_test/menu_test.module +++ b/core/modules/system/tests/modules/menu_test/menu_test.module @@ -432,10 +432,26 @@ function menu_test_menu() { 'type' => MENU_LOCAL_ACTION, ); + $items['menu-test-local-action/dynamic-title'] = array( + 'title' => 'My dynamic title action', + 'title callback' => 'menu_test_local_action_dynamic_title', + 'title arguments' => array(1), + 'route_name' => 'menu_test_local_action4', + 'weight' => -10, + 'type' => MENU_LOCAL_ACTION, + ); + return $items; } /** + * Title callback: Set a dynamic title for a local action. + */ +function menu_test_local_action_dynamic_title($arg) { + return t('My @arg action', array('@arg' => $arg)); +} + +/** * Implements hook_local_actions(). */ function menu_test_local_actions() { diff --git a/core/modules/system/tests/modules/menu_test/menu_test.routing.yml b/core/modules/system/tests/modules/menu_test/menu_test.routing.yml index 09b42ba..3154626 100644 --- a/core/modules/system/tests/modules/menu_test/menu_test.routing.yml +++ b/core/modules/system/tests/modules/menu_test/menu_test.routing.yml @@ -37,3 +37,10 @@ menu_test_local_action3: _content: '\Drupal\menu_test\TestControllers::test2' requirements: _access: 'TRUE' + +menu_test_local_action4: + pattern: '/menu-test-local-action/dynamic-title' + defaults: + _content: '\Drupal\menu_test\TestControllers::test2' + requirements: + _access: 'TRUE'