You are here

function webform_reply_to_form_submit in Webform Reply To 7

Same name and namespace in other branches
  1. 6 webform_reply_to.module \webform_reply_to_form_submit()
  2. 7.2 webform_reply_to.module \webform_reply_to_form_submit()
1 string reference to 'webform_reply_to_form_submit'
webform_reply_to_form_alter in ./webform_reply_to.module
Implements hook_form_alter().

File

./webform_reply_to.module, line 60
The Webform Reply-To module, which adds a Reply-To header to Webform E-mail.

Code

function webform_reply_to_form_submit($form, &$form_state) {

  // Ensure a webform record exists.
  $node = $form_state['values']['node'];
  webform_ensure_record($node);
  $email = array(
    'eid' => $form_state['values']['eid'],
    'nid' => $node->nid,
  );
  $field = 'reply_to';
  $option = $form_state['values'][$field . '_option'];
  if ($option == 'default') {
    $email[$field] = 'default';
  }
  else {
    $email[$field] = $form_state['values'][$field . '_' . $option];
  }

  // We should be using webform_email_update($email), but it returns an error due to
  // the NULL $email['excluded_components'], so we use drupal_write_record instead
  drupal_write_record('webform_emails', $email, array(
    'nid',
    'eid',
  ));
}