diff --git a/core/modules/system/lib/Drupal/system/EventSubscriber/RouteSubscriber.php b/core/modules/system/lib/Drupal/system/EventSubscriber/RouteSubscriber.php index a2ff6da..1d79878 100644 --- a/core/modules/system/lib/Drupal/system/EventSubscriber/RouteSubscriber.php +++ b/core/modules/system/lib/Drupal/system/EventSubscriber/RouteSubscriber.php @@ -34,11 +34,13 @@ static function getSubscribedEvents() { public function createSystemThemeRoutes(RouteBuildEvent $event) { $collection = $event->getRouteCollection(); foreach (list_themes() as $theme) { - $route = new Route('admin/appearance/settings/' . $theme->name, array( - '_form' => '\Drupal\system\Form\ThemeSettingsForm', 'theme_name' => $theme->name), array( - '_permission' => 'administer themes', - )); - $collection->add('system_theme_settings_' . $theme->name, $route); + if (!empty($theme->status)) { + $route = new Route('admin/appearance/settings/' . $theme->name, array( + '_form' => '\Drupal\system\Form\ThemeSettingsForm', 'theme_name' => $theme->name), array( + '_permission' => 'administer themes', + )); + $collection->add('system_theme_settings_' . $theme->name, $route); + } } } diff --git a/core/modules/system/lib/Drupal/system/Form/ThemeSettingsForm.php b/core/modules/system/lib/Drupal/system/Form/ThemeSettingsForm.php index 4658d00..73edc71 100644 --- a/core/modules/system/lib/Drupal/system/Form/ThemeSettingsForm.php +++ b/core/modules/system/lib/Drupal/system/Form/ThemeSettingsForm.php @@ -51,7 +51,7 @@ public static function create(ContainerInterface $container) { * Implements \Drupal\Core\Form\FormInterface::getFormID(). */ public function getFormID() { - return 'system_theme_settings_form'; + return 'system_theme_settings'; } /** @@ -66,7 +66,7 @@ public function buildForm(array $form, array &$form_state, $theme_name = '') { $themes = list_themes(); // Deny access if the theme is disabled or not found. - if (empty($themes[$theme_name]) || !$themes[$theme_name]->status) { + if (!empty($theme_name) && (empty($themes[$theme_name]) || !$themes[$theme_name]->status)) { throw new NotFoundHttpException(); } diff --git a/core/modules/system/system.module b/core/modules/system/system.module index 4e423c4..602c230 100644 --- a/core/modules/system/system.module +++ b/core/modules/system/system.module @@ -733,17 +733,18 @@ function system_menu() { // Theme configuration subtabs. $items['admin/appearance/settings/global'] = array( 'title' => 'Global settings', - 'route_name' => 'system_theme_settings', + 'route_name' => 'system_theme_settings_global', 'type' => MENU_DEFAULT_LOCAL_TASK, ); foreach (list_themes() as $key => $theme) { - $items['admin/appearance/settings/' . $theme->name] = array( - 'title' => $theme->info['name'], - 'type' => MENU_LOCAL_TASK, - 'access callback' => '_system_themes_access', - 'access arguments' => array($key), - ); + if (!empty($theme->status)) { + $items['admin/appearance/settings/' . $theme->name] = array( + 'title' => $theme->info['name'], + 'route_name' => 'system_theme_settings_' . $theme->name, + 'type' => MENU_LOCAL_TASK, + ); + } } // Modules.