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 c790a84..583793e 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 @@ -8,27 +8,52 @@ namespace Drupal\theme_test; use Drupal\Core\Controller\ControllerInterface; -use Symfony\Component\DependencyInjection\ContainerInterface; /** * Controller routines for theme test routes. */ -class ThemeTestController implements ControllerInterface { +class ThemeTestController { /** - * {@inheritdoc} + * Menu callback for testing that a theme template overrides a theme function. */ - public static function create(ContainerInterface $container) { - return new static(); + public function functionTemplateOverridden() { + return array( + '#theme' => 'theme_test_function_template_override', + ); } /** - * Menu callback for testing that a theme template overrides a theme function. + * Adds stylesheets to test theme .info.yml property processing. + * + * @see test_basetheme.info.yml + * @see test_subtheme.info.yml + * @see \Drupal\system\Tests\Theme\ThemeInfoStylesTest + * @see http://drupal.org/node/967266#comment-3689670 */ - function functionTemplateOverridden() { + public function infoStylesheets() { + $path = drupal_get_path('module', 'theme_test'); return array( - '#theme' => 'theme_test_function_template_override', + '#attached' => array( + 'css' => array( + "$path/css/base-override.css", + "$path/css/base-override.sub-remove.css", + "$path/css/base-remove.css", + "$path/css/base-remove.sub-override.css", + "$path/css/sub-override.css", + "$path/css/sub-remove.css", + ), + ), ); } + /** + * Tests template overridding based on filename. + */ + function testTemplate() { + return array( + '#theme' => 'theme_test_template_test', + ); + } + } 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..801e529 100644 --- a/core/modules/system/tests/modules/theme_test/theme_test.module +++ b/core/modules/system/tests/modules/theme_test/theme_test.module @@ -64,16 +64,6 @@ function theme_test_menu() { 'access callback' => TRUE, 'type' => MENU_CALLBACK, ); - $items['theme-test/template-test'] = array( - 'page callback' => 'theme_test_template_test_page_callback', - 'access callback' => TRUE, - 'type' => MENU_CALLBACK, - ); - $items['theme-test/info/stylesheets'] = array( - 'page callback' => 'theme_test_info_stylesheets', - 'access callback' => TRUE, - 'type' => MENU_CALLBACK, - ); $items['theme-test/function-template-overridden'] = array( 'theme callback' => '_theme_custom_theme', 'route_name' => 'function_template_override', @@ -97,32 +87,6 @@ function theme_test_request_listener_page_callback() { } /** - * Menu callback for testing template overridding based on filename. - */ -function theme_test_template_test_page_callback() { - return theme('theme_test_template_test'); -} - -/** - * Page callback; Adds stylesheets to test theme .info.yml property processing. - * - * @see test_basetheme.info.yml - * @see test_subtheme.info.yml - * @see \Drupal\system\Tests\Theme\ThemeInfoStylesTest - * @see http://drupal.org/node/967266#comment-3689670 - */ -function theme_test_info_stylesheets() { - $path = drupal_get_path('module', 'theme_test'); - drupal_add_css("$path/css/base-override.css"); - drupal_add_css("$path/css/base-override.sub-remove.css"); - drupal_add_css("$path/css/base-remove.css"); - drupal_add_css("$path/css/base-remove.sub-override.css"); - drupal_add_css("$path/css/sub-override.css"); - drupal_add_css("$path/css/sub-remove.css"); - return ''; -} - -/** * Custom theme callback. */ function _theme_custom_theme() { 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..66a4195 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,17 @@ function_template_override: _content: '\Drupal\theme_test\ThemeTestController::functionTemplateOverridden' requirements: _permission: 'access content' + +theme_test_info_stylesheets: + pattern: '/theme-test/info/stylesheets' + defaults: + _content: '\Drupal\theme_test\ThemeTestController::infoStylesheets' + requirements: + _access: 'TRUE' + +theme_test_template_test: + pattern: '/theme-test/template-test' + defaults: + _content: '\Drupal\theme_test\ThemeTestController::testTemplate' + requirements: + _access: 'TRUE'