function theme_enable

Enable a given list of themes.

Parameters

$theme_list: An array of theme names.

30 calls to theme_enable()
BlockAdminThemeTest::testAdminTheme in drupal/core/modules/block/lib/Drupal/block/Tests/BlockAdminThemeTest.php
Check for the accessibility of the admin theme on the block admin page.
BlockHiddenRegionTest::testBlockNotInHiddenRegion in drupal/core/modules/block/lib/Drupal/block/Tests/BlockHiddenRegionTest.php
Tests that hidden regions do not inherit blocks when a theme is enabled.
BlockTest::testCustomBlock in drupal/core/modules/block/lib/Drupal/block/Tests/BlockTest.php
Test creating custom block, moving it to a specific region and then deleting it.
BreakpointThemeTest::setUp in drupal/core/modules/breakpoint/lib/Drupal/breakpoint/Tests/BreakpointThemeTest.php
Sets up a Drupal site for running functional and integration tests.
ColorTest::setUp in drupal/core/modules/color/lib/Drupal/color/Tests/ColorTest.php
Sets up a Drupal site for running functional and integration tests.

... See full list

File

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

Code

function theme_enable($theme_list) {
  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
      ->set("enabled.{$key}", 0);
    $disabled_themes
      ->clear($key);

    // Install default configuration of the theme.
    config_install_default_config('theme', $key);
  }
  $theme_config
    ->save();
  $disabled_themes
    ->save();
  list_themes(TRUE);
  menu_router_rebuild();
  drupal_theme_rebuild();

  // Invoke hook_themes_enabled() after the themes have been enabled.
  module_invoke_all('themes_enabled', $theme_list);
}