You are here

public function ConfirmDeleteMultiple::submitForm in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/modules/comment/src/Form/ConfirmDeleteMultiple.php \Drupal\comment\Form\ConfirmDeleteMultiple::submitForm()

Form submission handler.

Parameters

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

\Drupal\Core\Form\FormStateInterface $form_state: The current state of the form.

Overrides FormInterface::submitForm

File

core/modules/comment/src/Form/ConfirmDeleteMultiple.php, line 120
Contains \Drupal\comment\Form\ConfirmDeleteMultiple.

Class

ConfirmDeleteMultiple
Provides the comment multiple delete confirmation form.

Namespace

Drupal\comment\Form

Code

public function submitForm(array &$form, FormStateInterface $form_state) {
  if ($form_state
    ->getValue('confirm')) {
    $this->commentStorage
      ->delete($this->comments);
    $count = count($form_state
      ->getValue('comments'));
    $this
      ->logger('content')
      ->notice('Deleted @count comments.', array(
      '@count' => $count,
    ));
    drupal_set_message($this
      ->formatPlural($count, 'Deleted 1 comment.', 'Deleted @count comments.'));
  }
  $form_state
    ->setRedirectUrl($this
    ->getCancelUrl());
}