You are here

public function ModulesUninstallConfirmForm::submitForm in Drupal 10

Same name and namespace in other branches
  1. 8 core/modules/system/src/Form/ModulesUninstallConfirmForm.php \Drupal\system\Form\ModulesUninstallConfirmForm::submitForm()
  2. 9 core/modules/system/src/Form/ModulesUninstallConfirmForm.php \Drupal\system\Form\ModulesUninstallConfirmForm::submitForm()

Form submission 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::submitForm

File

core/modules/system/src/Form/ModulesUninstallConfirmForm.php, line 168

Class

ModulesUninstallConfirmForm
Builds a confirmation form to uninstall selected modules.

Namespace

Drupal\system\Form

Code

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

  // Clear the key value store entry.
  $account = $this
    ->currentUser()
    ->id();
  $this->keyValueExpirable
    ->delete($account);

  // Uninstall the modules.
  $this->moduleInstaller
    ->uninstall($this->modules);
  $this
    ->messenger()
    ->addStatus($this
    ->t('The selected modules have been uninstalled.'));
  $form_state
    ->setRedirectUrl($this
    ->getCancelUrl());
}