1 color.install color_update_1000()

Convert color module settings to config files.

File

core/modules/color/color.install, line 11
Install, update and uninstall functions for the color module.

Code

function color_update_1000() {
  $themes = list_themes();
  foreach ($themes as $theme_key => $theme_info) {
    if ($palette = update_variable_get('color_' . $theme_key . '_palette')) {
      // Copy any existing settings into config.
      $config = config($theme_key . '.settings');
      $color_settings = array(
        'palette' => $palette,
        'stylesheets' => update_variable_get('color_' . $theme_key . '_stylesheets', array()),
        'files' => update_variable_get('color_' . $theme_key . '_files', array()),
      );
      $config->set('color', $color_settings);
      $config->save();

      // Delete the legacy variables.
      update_variable_del('color_' . $theme_key . '_palette');
      update_variable_del('color_' . $theme_key . '_stylesheets');
      update_variable_del('color_' . $theme_key . '_files');

      // Screenshot and logo support apparently was removed even in Drupal 7,
      // delete these variables if they still exist.
      update_variable_del('color_' . $theme_key . '_logo');
      update_variable_del('color_' . $theme_key . '_screenshot');
    }
  }
}