function ModulesUninstallForm::validateForm

Same name in other branches
  1. 9 core/modules/system/src/Form/ModulesUninstallForm.php \Drupal\system\Form\ModulesUninstallForm::validateForm()
  2. 8.9.x core/modules/system/src/Form/ModulesUninstallForm.php \Drupal\system\Form\ModulesUninstallForm::validateForm()
  3. 11.x core/modules/system/src/Form/ModulesUninstallForm.php \Drupal\system\Form\ModulesUninstallForm::validateForm()

Overrides FormBase::validateForm

File

core/modules/system/src/Form/ModulesUninstallForm.php, line 220

Class

ModulesUninstallForm
Provides a form for uninstalling modules.

Namespace

Drupal\system\Form

Code

public function validateForm(array &$form, FormStateInterface $form_state) {
    // Form submitted, but no modules selected.
    if (!array_filter($form_state->getValue('uninstall'))) {
        $form_state->setErrorByName('', $this->t('No modules selected.'));
        $form_state->setRedirect('system.modules_uninstall');
    }
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.