NodeForm::preview

public NodeForm::preview(array $form, FormStateInterface $form_state)

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 340

Class

NodeForm
Form handler 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',
  ));
}
doc_Drupal
2016-10-29 09:30:46
Comments
Leave a Comment

Please login to continue.