You are here

public function DevelReinstall::validateForm in Devel 8

Same name and namespace in other branches
  1. 8.3 src/Form/DevelReinstall.php \Drupal\devel\Form\DevelReinstall::validateForm()
  2. 8.2 src/Form/DevelReinstall.php \Drupal\devel\Form\DevelReinstall::validateForm()
  3. 4.x src/Form/DevelReinstall.php \Drupal\devel\Form\DevelReinstall::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/DevelReinstall.php, line 131

Class

DevelReinstall
Display a dropdown of installed modules with the option to reinstall them.

Namespace

Drupal\devel\Form

Code

public function validateForm(array &$form, FormStateInterface $form_state) {

  // Form submitted, but no modules selected.
  if (!array_filter($form_state
    ->getValue('reinstall'))) {
    $form_state
      ->setErrorByName('reinstall', $this
      ->t('No modules selected.'));
  }
}