You are here

public function BulkFormEntityListBuilder::validateForm in Entity API 8

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 FormInterface::validateForm

File

src/BulkFormEntityListBuilder.php, line 169

Class

BulkFormEntityListBuilder
Provides a list builder that allows using bulk actions.

Namespace

Drupal\entity

Code

public function validateForm(array &$form, FormStateInterface $form_state) {
  $selected = array_filter($form_state
    ->getValue($this->entitiesKey));
  if (empty($selected)) {
    $form_state
      ->setErrorByName($this->entitiesKey, $this
      ->t('No items selected.'));
  }
}