diff --git a/core/modules/system/lib/Drupal/system/Controller/ThemeController.php b/core/modules/system/lib/Drupal/system/Controller/ThemeController.php index d715622..43166f0 100644 --- a/core/modules/system/lib/Drupal/system/Controller/ThemeController.php +++ b/core/modules/system/lib/Drupal/system/Controller/ThemeController.php @@ -19,7 +19,7 @@ class ThemeController extends ControllerBase { /** * Disables a theme. - * + * * @param \Symfony\Component\HttpFoundation\Request $request * A request object containing a theme name and a valid token. * @@ -33,6 +33,7 @@ class ThemeController extends ControllerBase { public function disable(Request $request) { $theme = $request->get('theme'); $token = $request->get('token'); + $config = $this->config('system.theme'); if (isset($theme) && isset($token) && drupal_valid_token($token, 'system-theme-operation-link')) { // Get current list of themes. @@ -41,7 +42,7 @@ public function disable(Request $request) { // Check if the specified theme is one recognized by the system. if (!empty($themes[$theme])) { // Do not disable the default or admin theme. - if ($theme === $this->config('system.theme')->get('default') || $theme === $this->config('system.theme')->get('admin')) { + if ($theme === $config->get('default') || $theme === $config->get('admin')) { drupal_set_message($this->t('%theme is the default theme and cannot be disabled.', array('%theme' => $themes[$theme]->info['name'])), 'error'); } else { @@ -110,7 +111,7 @@ public function enable(Request $request) { */ public function defaultTheme(Request $request) { // Set the page title. - drupal_set_title($this->t('Set default theme')); + $config = $this->config('system.theme'); $theme = $request->query->get('theme'); $token = $request->query->get('token'); @@ -126,8 +127,7 @@ public function defaultTheme(Request $request) { } // Set the default theme. - $this->config('system.theme')->set('default', $theme) - ->save(); + $config->set('default', $theme)->save(); // Rebuild the menu. This duplicates the menu_router_rebuild() in // theme_enable(). However, modules must know the current default theme in @@ -139,7 +139,7 @@ public function defaultTheme(Request $request) { // The status message depends on whether an admin theme is currently in use: // a value of 0 means the admin theme is set to be the default theme. - $admin_theme = $this->config('system.theme')->get('admin'); + $admin_theme = $config->get('admin'); if ($admin_theme != 0 && $admin_theme != $theme) { drupal_set_message($this->t('Please note that the administration theme is still set to the %admin_theme theme; consequently, the theme on this page remains unchanged. All non-administrative sections of the site, however, will show the selected %selected_theme theme by default.', array( '%admin_theme' => $themes[$admin_theme]->info['name'], diff --git a/core/modules/system/system.routing.yml b/core/modules/system/system.routing.yml index 9e3171c..cd6c2d6 100644 --- a/core/modules/system/system.routing.yml +++ b/core/modules/system/system.routing.yml @@ -317,6 +317,7 @@ system_theme_default: pattern: '/admin/appearance/default' defaults: _controller: 'Drupal\system\Controller\ThemeController::defaultTheme' + _title: 'Set default theme' requirements: _permission: 'administer themes'