You are here

function mailsystem_admin_settings_submit in Mail System 8

Same name and namespace in other branches
  1. 8.2 mailsystem.admin.inc \mailsystem_admin_settings_submit()
  2. 6.2 mailsystem.admin.inc \mailsystem_admin_settings_submit()
  3. 6 mailsystem.admin.inc \mailsystem_admin_settings_submit()
  4. 7.3 mailsystem.admin.inc \mailsystem_admin_settings_submit()
  5. 7 mailsystem.admin.inc \mailsystem_admin_settings_submit()
  6. 7.2 mailsystem.admin.inc \mailsystem_admin_settings_submit()

Processes mailsystem_admin_settings form.

1 string reference to 'mailsystem_admin_settings_submit'
mailsystem_admin_settings in ./mailsystem.admin.inc
@file Administrative form for setting the mail_system variable.

File

./mailsystem.admin.inc, line 99
Administrative form for setting the mail_system variable.

Code

function mailsystem_admin_settings_submit($form, &$form_state) {
  $default_id = mailsystem_default_id();
  $mail_system = array(
    $default_id => empty($form_state['values'][$default_id]) ? mailsystem_default_value() : $form_state['values'][$default_id],
  );
  foreach (element_children($form_state['values']['mailsystem']) as $module) {
    $class = $form_state['values']['mailsystem'][$module];
    if (!empty($class) && $class != $default_id) {
      $mail_system[$module] = $class;
    }
  }
  unset($form_state['values']['mailsystem']);
  if ($id = $form_state['values']['identifier']['module']) {
    if (!empty($form_state['values']['identifier']['key'])) {
      $id .= '_' . $form_state['values']['identifier']['key'];
    }
    $mail_system[$id] = $mail_system[mailsystem_default_id()];
  }
  unset($form_state['values']['identifier']);
  variable_set('mail_system', $mail_system);
}