function theme_disable

Disable a given list of themes.

Parameters

$theme_list: An array of theme names.

6 calls to theme_disable()
BreakpointThemeTest::testThemeBreakpointGroup in drupal/core/modules/breakpoint/lib/Drupal/breakpoint/Tests/BreakpointThemeTest.php
Test the breakpoints defined by the custom group.
BreakpointThemeTest::testThemeBreakpointGroupModule in drupal/core/modules/breakpoint/lib/Drupal/breakpoint/Tests/BreakpointThemeTest.php
Test the breakpoints defined by the custom group in the module.
BreakpointThemeTest::testThemeBreakpoints in drupal/core/modules/breakpoint/lib/Drupal/breakpoint/Tests/BreakpointThemeTest.php
Test the breakpoints provided by a theme.
RouterTest::setUp in drupal/core/modules/system/lib/Drupal/system/Tests/Menu/RouterTest.php
Sets up a Drupal site for running functional and integration tests.
standard_install in drupal/core/profiles/standard/standard.install
Implements hook_install().

... See full list

File

drupal/core/includes/theme.inc, line 1494
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(variable_get('theme_default', 'stark'), $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);
}