function theme_disable

Disables a given list of themes.

Parameters

$theme_list: An array of theme names.

6 calls to theme_disable()

File

drupal/core/includes/theme.inc, line 1524
The theme system, which controls the output of Drupal.

Code

function theme_disable($theme_list) {

  // Don't disable the default theme.
  if ($pos = array_search(config('system.theme')
    ->get('default'), $theme_list) !== FALSE) {
    unset($theme_list[$pos]);
    if (empty($theme_list)) {
      return;
    }
  }
  drupal_clear_css_cache();
  $theme_config = config('system.theme');
  $disabled_themes = config('system.theme.disabled');
  foreach ($theme_list as $key) {

    // The value is not used; the weight is ignored for themes currently.
    $theme_config
      ->clear("enabled.{$key}");
    $disabled_themes
      ->set($key, 0);
  }
  $theme_config
    ->save();
  $disabled_themes
    ->save();
  list_themes(TRUE);
  menu_router_rebuild();
  drupal_theme_rebuild();

  // Invoke hook_themes_disabled after the themes have been disabled.
  module_invoke_all('themes_disabled', $theme_list);
}