You are here

function styleswitcher_config_theme_submit in Style Switcher 6.2

Same name and namespace in other branches
  1. 7.2 styleswitcher.admin.inc \styleswitcher_config_theme_submit()

Form submission handler for styleswitcher_config_theme().

See also

styleswitcher_config_theme_validate()

File

./styleswitcher.admin.inc, line 148
Styleswitcher configuration functionality.

Code

function styleswitcher_config_theme_submit($form, &$form_state) {
  $theme = $form_state['values']['theme_name'];
  $values = $form_state['values']['settings'];
  $theme_settings = array();
  foreach (array_keys(styleswitcher_style_load_multiple($theme)) as $name) {
    $theme_settings[$name] = array(
      'weight' => $values['weight'][$name],
      'status' => !empty($values['enabled'][$name]),
      'is_default' => $values['default'] == $name,
    );
  }

  // Get all settings (for all themes).
  $settings = variable_get('styleswitcher_styles_settings', array());
  $settings[$theme] = $theme_settings;
  variable_set('styleswitcher_styles_settings', $settings);
  drupal_set_message(t('The configuration options have been saved.'));
  _styleswitcher_configuration_changed();
}