You are here

function spaces_preset_default_form_submit in Spaces 5.2

Same name and namespace in other branches
  1. 6 spaces_admin.inc \spaces_preset_default_form_submit()
  2. 6.2 spaces_admin.inc \spaces_preset_default_form_submit()

Submit handler for spaces_preset_default_form().

File

./spaces_admin.inc, line 85

Code

function spaces_preset_default_form_submit($form_id, $form_values) {
  switch (trim($form_values['op'])) {
    case t('Save defaults'):
      $default_presets = variable_get('spaces_default_presets', array());
      foreach (spaces_types() as $type => $dummy) {
        if (isset($form_values['types'][$type]['default']) && !empty($form_values['types'][$type]['default'])) {
          $default_presets[$type] = $form_values['types'][$type]['default'];
        }
        else {
          unset($default_presets[$type]);
        }
      }
      variable_set('spaces_default_presets', $default_presets);
      drupal_set_message(t('Spaces preset defaults were saved successfully.'));
      break;
    case t('Clear defaults'):
      variable_del('spaces_default_presets');
      drupal_set_message(t('Spaces preset defaults were cleared successfully.'));
      break;
  }
  return;
}