1.20.x theme.inc theme_disable($theme_list)

Disables a given list of themes.

Parameters

$theme_list: An array of theme names.

File

includes/theme.inc, line 1649
The theme system, which controls the output of Backdrop.

Code

function theme_disable($theme_list) {
  // Don't disable the default theme.
  if ($pos = array_search(config_get('system.core', 'theme_default'), $theme_list) !== FALSE) {
    unset($theme_list[$pos]);
    if (empty($theme_list)) {
      return;
    }
  }

  backdrop_clear_css_cache();

  foreach ($theme_list as $key) {
    db_update('system')
      ->fields(array('status' => 0))
      ->condition('type', 'theme')
      ->condition('name', $key)
      ->execute();
  }

  list_themes(TRUE);
  menu_rebuild();
  backdrop_theme_rebuild();

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