Enable a given list of themes.
$theme_list: An array of theme names.
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);
}