diff --git a/core/modules/system/tests/modules/theme_test/lib/Drupal/theme_test/ThemeTestController.php b/core/modules/system/tests/modules/theme_test/lib/Drupal/theme_test/ThemeTestController.php index d9f0767..2ab7143 100644 --- a/core/modules/system/tests/modules/theme_test/lib/Drupal/theme_test/ThemeTestController.php +++ b/core/modules/system/tests/modules/theme_test/lib/Drupal/theme_test/ThemeTestController.php @@ -7,20 +7,12 @@ namespace Drupal\theme_test; -use Drupal\Core\DependencyInjection\ContainerInjectionInterface; -use Symfony\Component\DependencyInjection\ContainerInterface; +use Drupal\Core\Controller\ControllerBase; /** * Controller routines for theme test routes. */ -class ThemeTestController implements ContainerInjectionInterface { - - /** - * {@inheritdoc} - */ - public static function create(ContainerInterface $container) { - return new static(); - } +class ThemeTestController extends ControllerBase { /** * Menu callback for testing that a theme template overrides a theme function. @@ -31,4 +23,16 @@ function functionTemplateOverridden() { ); } + /** + * Calls drupal_alter(). + * + * This is for testing that the theme can have hook_*_alter() implementations + * that run during page callback execution, even before theme() is called for + * the first time. + */ + function themeTestAlter() { + $data = 'foo'; + $this->moduleHandler()->alter('theme_test_alter', $data); + return "The altered data is $data."; + } } diff --git a/core/modules/system/tests/modules/theme_test/theme_test.module b/core/modules/system/tests/modules/theme_test/theme_test.module index 40a78f3..6ab8f04 100644 --- a/core/modules/system/tests/modules/theme_test/theme_test.module +++ b/core/modules/system/tests/modules/theme_test/theme_test.module @@ -54,8 +54,7 @@ function theme_test_menu() { ); $items['theme-test/alter'] = array( 'title' => 'Suggestion', - 'page callback' => '_theme_test_alter', - 'access callback' => TRUE, + 'route_name' => 'theme_test_alter', 'theme callback' => '_theme_custom_theme', 'type' => MENU_CALLBACK, ); @@ -130,19 +129,6 @@ function _theme_custom_theme() { } /** - * Page callback, calls drupal_alter(). - * - * This is for testing that the theme can have hook_*_alter() implementations - * that run during page callback execution, even before theme() is called for - * the first time. - */ -function _theme_test_alter() { - $data = 'foo'; - drupal_alter('theme_test_alter', $data); - return "The altered data is $data."; -} - -/** * Page callback, calls a theme hook suggestion. */ function _theme_test_suggestion() { diff --git a/core/modules/system/tests/modules/theme_test/theme_test.routing.yml b/core/modules/system/tests/modules/theme_test/theme_test.routing.yml index 866171e..6fd74ae 100644 --- a/core/modules/system/tests/modules/theme_test/theme_test.routing.yml +++ b/core/modules/system/tests/modules/theme_test/theme_test.routing.yml @@ -4,3 +4,10 @@ function_template_override: _content: '\Drupal\theme_test\ThemeTestController::functionTemplateOverridden' requirements: _permission: 'access content' + +theme_test_alter: + pattern: 'theme-test/alter' + defaults: + _content: '\Drupal\theme_test\ThemeTestController::themeTestAlter' + requirements: + _access: 'TRUE'