1 node.pages.inc node_form_preview($form, &$form_state)

Form submission handler that redirects to the node preview().

@since 1.11.0

See also

node_form_validate()

node_form_submit_build_node()

File

core/modules/node/node.pages.inc, line 503
Callbacks for adding, editing, and deleting content and managing revisions.

Code

function node_form_preview($form, &$form_state) {
  $node_tempstore_id = $form_state['node_tempstore_id'];
  $old_status = $form_state['values']['status'];
  $node = node_form_submit_build_node($form, $form_state);
  $node->old_status = $old_status;

  node_set_node_tempstore($node, $node_tempstore_id);
  $form_state['redirect'] = 'node/preview/' . str_replace('_', '-', $node->type) . '/' . $node_tempstore_id;
  if (isset($_GET['destination'])) {
    $_GET['destination'] = $form_state['redirect'];
  }
}