CommentAdminOverview::validateForm

public CommentAdminOverview::validateForm(array &$form, FormStateInterface $form_state)

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 244

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.'));
  }
}
doc_Drupal
2016-10-29 08:50:30
Comments
Leave a Comment

Please login to continue.