diff --git a/core/modules/system/system.admin.inc b/core/modules/system/system.admin.inc index d344d37..6e5b451 100644 --- a/core/modules/system/system.admin.inc +++ b/core/modules/system/system.admin.inc @@ -305,33 +305,7 @@ function system_theme_enable() { throw new AccessDeniedHttpException(); } -/** - * Menu callback; Disables a theme. - */ -function system_theme_disable() { - if (isset($_REQUEST['theme']) && isset($_REQUEST['token']) && drupal_valid_token($_REQUEST['token'], 'system-theme-operation-link')) { - $theme = $_REQUEST['theme']; - // 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(); -} /** * Menu callback; Set the default theme. diff --git a/core/modules/system/system.module b/core/modules/system/system.module index 4d2f61e..6c50bdb 100644 --- a/core/modules/system/system.module +++ b/core/modules/system/system.module @@ -711,10 +711,8 @@ function system_menu() { ); $items['admin/appearance/disable'] = array( 'title' => 'Disable theme', - 'page callback' => 'system_theme_disable', - 'access arguments' => array('administer themes'), + 'route_name' => 'system_theme_disable', 'type' => MENU_CALLBACK, - 'file' => 'system.admin.inc', ); $items['admin/appearance/default'] = array( 'title' => 'Set default theme', diff --git a/core/modules/system/system.routing.yml b/core/modules/system/system.routing.yml index b285844..2d47922 100644 --- a/core/modules/system/system.routing.yml +++ b/core/modules/system/system.routing.yml @@ -73,3 +73,11 @@ system_site_maintenance_mode: _form: 'Drupal\system\Form\SiteMaintenanceModeForm' requirements: _permission: 'administer site configuration' + +system_theme_disable: + pattern: '/admin/appearance/disable' + defaults: + _controller: 'Drupal\system\Controller\ThemeController::disable' + requirements: + _permission: 'administer themes' +