You are here

function system_settings_form_submit in Drupal 4

Same name and namespace in other branches
  1. 5 modules/system/system.module \system_settings_form_submit()
  2. 6 modules/system/system.module \system_settings_form_submit()
  3. 7 modules/system/system.module \system_settings_form_submit()

Execute the system_settings_form.

If you want node type configure style handling of your checkboxes, add an array_filter value to your form.

File

modules/system.module, line 781
Configuration system that lets administrators modify the workings of the site.

Code

function system_settings_form_submit($form_id, $values) {
  $op = isset($_POST['op']) ? $_POST['op'] : '';

  // Exclude unnecessary elements.
  unset($values['submit'], $values['reset'], $values['form_id'], $values['form_token']);
  foreach ($values as $key => $value) {
    if ($op == t('Reset to defaults')) {
      variable_del($key);
    }
    else {
      if (is_array($value) && isset($values['array_filter'])) {
        $value = array_keys(array_filter($value));
      }
      variable_set($key, $value);
    }
  }
  if ($op == t('Reset to defaults')) {
    drupal_set_message(t('The configuration options have been reset to their default values.'));
  }
  else {
    drupal_set_message(t('The configuration options have been saved.'));
  }
  menu_rebuild();
}