You are here

public function CommentForm::preview in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/modules/comment/src/CommentForm.php \Drupal\comment\CommentForm::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/comment/src/CommentForm.php, line 343
Contains \Drupal\comment\CommentForm.

Class

CommentForm
Base for controller for comment forms.

Namespace

Drupal\comment

Code

public function preview(array &$form, FormStateInterface $form_state) {
  $comment_preview = comment_preview($this->entity, $form_state);
  $comment_preview['#title'] = $this
    ->t('Preview comment');
  $form_state
    ->set('comment_preview', $comment_preview);
  $form_state
    ->setRebuild();
}