You are here

function pet_make_preview in Previewable email templates 7

Same name and namespace in other branches
  1. 6 pet.admin.inc \pet_make_preview()

Generate a preview of the tokenized email for the first in the list.

1 call to pet_make_preview()
pet_user_form_submit in includes/pet.admin.inc
Form submission. Take action on step 2 (confirmation of the populated templates).

File

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

Code

function pet_make_preview(&$form_state) {
  $params = array(
    'pet_uid' => $form_state['storage']['recipients'][0]['uid'],
    'pet_nid' => $form_state['storage']['nid'],
  );
  $subs = pet_substitutions($form_state['storage']['pet'], $params);
  $form_state['storage']['subject_preview'] = token_replace($form_state['values']['subject'], $subs);
  $form_state['storage']['body_preview'] = token_replace(pet_isset_or($form_state['values']['mail_body']), $subs);
  $form_state['storage']['body_preview_plain'] = token_replace(pet_isset_or($form_state['values']['mail_body_plain']), $subs);
}