You are here

function clientside_validation_settings_form_submit in Clientside Validation 7

Same name and namespace in other branches
  1. 7.2 clientside_validation.admin.inc \clientside_validation_settings_form_submit()

File

./clientside_validation.admin.inc, line 521
Admin settings for Clientside Validation

Code

function clientside_validation_settings_form_submit($form, &$form_state) {
  $values = $form_state['values'];
  $cvs_type = $values['cvs_type'];
  $cvs_formid = $values['cvs_formid'];
  $new = $values['new'];
  unset($values['submit']);
  unset($values['form_build_id']);
  unset($values['form_token']);
  unset($values['form_id']);
  unset($values['op']);
  unset($values['cvs_type']);
  unset($values['cvs_formid']);
  unset($values['new']);
  if ($cvs_type == 'default') {
    variable_set('clientside_validation_default_settings', $values);
  }
  else {

    // Remove not overloaded settings
    foreach (array(
      'validate_options',
      'error',
      'error_placement',
      'include_hidden',
    ) as $set) {
      if (isset($values[$set . '_override_default']) && $values[$set . '_override_default'] === 0) {
        unset($values[$set]);
      }
    }
    if (!$new) {
      clientside_validation_settings_update($cvs_type, $cvs_formid, $values);
    }
    else {
      clientside_validation_settings_add($cvs_type, $cvs_formid, $values, TRUE);
    }
  }
}