You are here

public function SocialCommentAdminOverview::validateForm in Open Social 8.8

Same name and namespace in other branches
  1. 8.9 modules/social_features/social_comment/src/Form/SocialCommentAdminOverview.php \Drupal\social_comment\Form\SocialCommentAdminOverview::validateForm()
  2. 8.3 modules/social_features/social_comment/src/Form/SocialCommentAdminOverview.php \Drupal\social_comment\Form\SocialCommentAdminOverview::validateForm()
  3. 8.4 modules/social_features/social_comment/src/Form/SocialCommentAdminOverview.php \Drupal\social_comment\Form\SocialCommentAdminOverview::validateForm()
  4. 8.5 modules/social_features/social_comment/src/Form/SocialCommentAdminOverview.php \Drupal\social_comment\Form\SocialCommentAdminOverview::validateForm()
  5. 8.6 modules/social_features/social_comment/src/Form/SocialCommentAdminOverview.php \Drupal\social_comment\Form\SocialCommentAdminOverview::validateForm()
  6. 8.7 modules/social_features/social_comment/src/Form/SocialCommentAdminOverview.php \Drupal\social_comment\Form\SocialCommentAdminOverview::validateForm()
  7. 10.3.x modules/social_features/social_comment/src/Form/SocialCommentAdminOverview.php \Drupal\social_comment\Form\SocialCommentAdminOverview::validateForm()
  8. 10.0.x modules/social_features/social_comment/src/Form/SocialCommentAdminOverview.php \Drupal\social_comment\Form\SocialCommentAdminOverview::validateForm()
  9. 10.1.x modules/social_features/social_comment/src/Form/SocialCommentAdminOverview.php \Drupal\social_comment\Form\SocialCommentAdminOverview::validateForm()
  10. 10.2.x modules/social_features/social_comment/src/Form/SocialCommentAdminOverview.php \Drupal\social_comment\Form\SocialCommentAdminOverview::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

modules/social_features/social_comment/src/Form/SocialCommentAdminOverview.php, line 252

Class

SocialCommentAdminOverview
Provides the comments overview administration form.

Namespace

Drupal\social_comment\Form

Code

public function validateForm(array &$form, FormStateInterface $form_state) {
  $form_state
    ->setValue('comments', array_diff($form_state
    ->getValue('comments'), [
    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.'));
  }
}