You are here

public function DblogFilterForm::validateForm in Drupal 9

Same name and namespace in other branches
  1. 8 core/modules/dblog/src/Form/DblogFilterForm.php \Drupal\dblog\Form\DblogFilterForm::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/dblog/src/Form/DblogFilterForm.php, line 70

Class

DblogFilterForm
Provides the database logging filter form.

Namespace

Drupal\dblog\Form

Code

public function validateForm(array &$form, FormStateInterface $form_state) {
  if ($form_state
    ->isValueEmpty('type') && $form_state
    ->isValueEmpty('severity')) {
    $form_state
      ->setErrorByName('type', $this
      ->t('You must select something to filter by.'));
  }
}