You are here

public function NodeForm::preview in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/modules/node/src/NodeForm.php \Drupal\node\NodeForm::preview()

Form submission handler for the 'preview' action.

Parameters

$form: An associative array containing the structure of the form.

$form_state: The current state of the form.

File

core/modules/node/src/NodeForm.php, line 345
Contains \Drupal\node\NodeForm.

Class

NodeForm
Form controller for the node edit forms.

Namespace

Drupal\node

Code

public function preview(array $form, FormStateInterface $form_state) {
  $store = $this->tempStoreFactory
    ->get('node_preview');
  $this->entity->in_preview = TRUE;
  $store
    ->set($this->entity
    ->uuid(), $form_state);
  $form_state
    ->setRedirect('entity.node.preview', array(
    'node_preview' => $this->entity
      ->uuid(),
    'view_mode_id' => 'default',
  ));
}