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',
));
}
Please login to continue.