diff --git a/core/modules/system/lib/Drupal/system/Controller/ThemeController.php b/core/modules/system/lib/Drupal/system/Controller/ThemeController.php new file mode 100644 index 0000000..e28e20d --- /dev/null +++ b/core/modules/system/lib/Drupal/system/Controller/ThemeController.php @@ -0,0 +1,46 @@ +get('theme'); + $token = $request->get('token'); + if (isset($theme) && isset($token) && drupal_valid_token($token, 'system-theme-operation-link')) { + // Get current list of themes. + $themes = list_themes(); + + // 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 === config('system.theme')->get('default') || $theme === config('system.theme')->get('admin')) { + drupal_set_message(t('%theme is the default theme and cannot be disabled.', array('%theme' => $themes[$theme]->info['name'])), 'error'); + } + else { + theme_disable(array($theme)); + drupal_set_message(t('The %theme theme has been disabled.', array('%theme' => $themes[$theme]->info['name']))); + } + } + else { + drupal_set_message(t('The %theme theme was not found.', array('%theme' => $theme)), 'error'); + } + drupal_goto('admin/appearance'); + } + throw new AccessDeniedHttpException(); + } +}