1 system.admin.inc system_theme_disable_confirm_submit($form, &$form_state)

Form submission handler for system_theme_disable_confirm_submit().

File

core/modules/system/system.admin.inc, line 333
Admin page callbacks for the System module.

Code

function system_theme_disable_confirm_submit($form, &$form_state) {
  $theme = $form_state['complete_form']['theme']['#value'];
  // Get current list of themes.
  $themes = list_themes();

  // Check if the specified theme is one recognized by the system.
  if (!empty($themes[$theme])) {
    if ($theme == config_get('system.core', 'theme_default')) {
      // Don't disable the default theme.
      backdrop_set_message(t('%theme is the default theme and cannot be disabled.', array('%theme' => $themes[$theme]->info['name'])), 'error');
    }
    else {
      theme_disable(array($theme));
      backdrop_set_message(t('The %theme theme has been disabled.', array('%theme' => $themes[$theme]->info['name'])));
    }
  }
  else {
    backdrop_set_message(t('The %theme theme was not found.', array('%theme' => $theme)), 'error');
  }

  $form_state['redirect'] = 'admin/appearance';
}