You are here

public function WebformBulkFormBase::validateForm in Webform 8.5

Same name and namespace in other branches
  1. 6.x src/Form/WebformBulkFormBase.php \Drupal\webform\Form\WebformBulkFormBase::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

src/Form/WebformBulkFormBase.php, line 105

Class

WebformBulkFormBase
Provides the webform bulk form base.

Namespace

Drupal\webform\Form

Code

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