You are here

public function CommentAdminOverview::validateForm in Zircon Profile 8

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

Form validation 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 FormBase::validateForm

File

core/modules/comment/src/Form/CommentAdminOverview.php, line 249
Contains \Drupal\comment\Form\CommentAdminOverview.

Class

CommentAdminOverview
Provides the comments overview administration form.

Namespace

Drupal\comment\Form

Code

public function validateForm(array &$form, FormStateInterface $form_state) {
  $form_state
    ->setValue('comments', array_diff($form_state
    ->getValue('comments'), array(
    0,
  )));

  // We can't execute any 'Update options' if no comments were selected.
  if (count($form_state
    ->getValue('comments')) == 0) {
    $form_state
      ->setErrorByName('', $this
      ->t('Select one or more comments to perform the update on.'));
  }
}