You are here

function mailsystem_admin_add_setting_validate in Mail System 7.3

Form validation handler for mailsystem settings form.

Add an additional custom setting for a module/key.

1 string reference to 'mailsystem_admin_add_setting_validate'
mailsystem_admin_settings in ./mailsystem.admin.inc
Form constructor for the mailsystem settings form.

File

./mailsystem.admin.inc, line 159
Administrative interface for the mail_system variable.

Code

function mailsystem_admin_add_setting_validate($fieldset, &$form_state) {

  // Only perform this validation if we're adding a custom setting.
  if (!isset($form_state['submit_handlers']) || !in_array('mailsystem_admin_add_setting_submit', $form_state['submit_handlers'])) {
    return;
  }
  $module = $fieldset['module']['#value'];
  $key = $fieldset['key']['#value'];
  $id = $module;
  if (!empty($key)) {
    $id .= '_' . $key;
  }
  $mail_system = mailsystem_get();
  if (isset($mail_system[$id])) {
    form_error($fieldset['module'], t('A setting already exists for this combination of module and key'));
  }
  $form_state['new_settings_id'] = $id;
}