You are here

function privatemsg_new_preview in Privatemsg 7

Same name and namespace in other branches
  1. 6.2 privatemsg.pages.inc \privatemsg_new_preview()
  2. 7.2 privatemsg.pages.inc \privatemsg_new_preview()
1 string reference to 'privatemsg_new_preview'
privatemsg_new in ./privatemsg.pages.inc

File

./privatemsg.pages.inc, line 597
User menu callbacks for Privatemsg.

Code

function privatemsg_new_preview($form, &$form_state) {
  $message = $form_state['validate_built_message'];

  // Execute submit hook, removes empty fields.
  field_attach_submit('privatemsg_message', $message, $form, $form_state);

  // Load information attached to the message. Use an internal function
  // to avoid the internal field cache.
  _field_invoke_multiple('load', 'privatemsg_message', array(
    $message->mid => $message,
  ));
  $form_state['privatemsg_preview'] = array(
    '#markup' => theme('privatemsg_view', array(
      'message' => $message,
    )),
  );

  // This forces the form to be rebuilt instead of being submitted.
  $form_state['rebuild'] = TRUE;
}