You are here

function chosen_update_7204 in Chosen 7.2

Implements hook_update_N().

Set the 'Disable the default Chosen theme' Chosen setting to the opposite of the current general'Use the default chosen theme' Chosen setting for all enabled themes.

File

./chosen.install, line 119
Installation and uninstallation functions.

Code

function chosen_update_7204() {
  module_load_include('inc', 'chosen', 'chosen.admin');
  $chosen_use_theme_setting = variable_get('chosen_use_theme', TRUE);

  // We now chose to disable the default Chosen CSS instead of deselecting
  // the 'Use the default chosen theme' option box.
  if (!$chosen_use_theme_setting) {
    $themes = system_list('theme');
    foreach ($themes as $theme) {

      // Only create options for enabled themes.
      if ($theme->status) {
        $options[$theme->name] = $theme->info['name'];
      }
    }
    variable_set('chosen_disabled_themes', array_keys($options));
  }

  // Delete the old variable.
  variable_del('chosen_use_theme');
}