You are here

function pet_user_form_submit in Previewable email templates 6

Same name and namespace in other branches
  1. 7 includes/pet.admin.inc \pet_user_form_submit()

Form submission. Take action on step 2 (confirmation of the populated templates).

File

./pet.admin.inc, line 461
Contains administrative pages for creating, editing, and deleting previewable email templates (PETs).

Code

function pet_user_form_submit($form, &$form_state) {
  $step = empty($form_state['storage']['step']) ? 1 : $form_state['storage']['step'];
  $form_state['storage']['step'] = $step;
  switch ($step) {
    case 1:
      $form_state['storage']['recipients_raw'] = $form_state['values']['recipients'];
      $form_state['storage']['subject'] = $form_state['values']['subject'];
      $form_state['storage']['mail_body'] = $form_state['values']['mail_body'];
      $form_state['storage']['cc'] = $form_state['values']['cc'];
      $form_state['storage']['bcc'] = $form_state['values']['bcc'];
      pet_make_preview($form_state);
      break;
    case 2:
      $name = $form_state['storage']['pet']->name;
      $recipients = $form_state['storage']['recipients'];
      $nid = $form_state['storage']['nid'];
      $subject = $form_state['storage']['subject'];
      $body = $form_state['storage']['mail_body'];
      $from = NULL;

      // use PET or default setting
      $cc = $form_state['storage']['cc'];
      $bcc = $form_state['storage']['bcc'];
      pet_send_mail($name, $recipients, $nid, $subject, $body, $from, $cc, $bcc);
      break;
  }
  $form_state['storage']['step']++;
}