You are here

function styleswitcher_update_7203 in Style Switcher 7.2

Prefix style keys in persistent variable.

File

./styleswitcher.install, line 104
Installation tasks.

Code

function styleswitcher_update_7203() {
  if ($styles = variable_get('styleswitcher_styles')) {
    $updated_styles = array();
    foreach ($styles as $key => $style) {
      if (strpos($key, 'theme/') !== 0 && strpos($key, 'custom/') !== 0) {
        $prefix = empty($style['custom']) ? 'theme/' : 'custom/';
        $key = $style['name'] = $prefix . $key;
      }
      $updated_styles[$key] = $style;
    }
    variable_set('styleswitcher_styles', $updated_styles);
  }
}