You are here

function privatemsg_new_preview in Privatemsg 7.2

Same name and namespace in other branches
  1. 6.2 privatemsg.pages.inc \privatemsg_new_preview()
  2. 7 privatemsg.pages.inc \privatemsg_new_preview()
1 string reference to 'privatemsg_new_preview'
_privatemsg_form_base_fields in ./privatemsg.pages.inc
Returns the common fields of the reply and new form.

File

./privatemsg.pages.inc, line 671
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,
    )),
    '#attached' => array(
      drupal_get_path('module', 'privatemsg') . '/styles/privatemsg-view.base.css',
      drupal_get_path('module', 'privatemsg') . '/styles/privatemsg-view.theme.css',
    ),
  );

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