You are here

function system_settings_form_submit in Drupal 6

Same name and namespace in other branches
  1. 4 modules/system.module \system_settings_form_submit()
  2. 5 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.

2 calls to system_settings_form_submit()
system_date_time_settings_submit in modules/system/system.admin.inc
Process system_date_time_settings form submissions.
update_settings_submit in modules/update/update.settings.inc
Submit handler for the settings tab.
1 string reference to 'system_settings_form_submit'
system_settings_form in modules/system/system.module
Add default buttons to a form and set its prefix.

File

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

Code

function system_settings_form_submit($form, &$form_state) {
  $op = isset($form_state['values']['op']) ? $form_state['values']['op'] : '';

  // Exclude unnecessary elements.
  unset($form_state['values']['submit'], $form_state['values']['reset'], $form_state['values']['form_id'], $form_state['values']['op'], $form_state['values']['form_token'], $form_state['values']['form_build_id']);
  foreach ($form_state['values'] as $key => $value) {
    if ($op == t('Reset to defaults')) {
      variable_del($key);
    }
    else {
      if (is_array($value) && isset($form_state['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.'));
  }
  cache_clear_all();
  drupal_rebuild_theme_registry();
}