function ModulesUninstallForm::submitForm

Same name and namespace in other branches
  1. 9 core/modules/system/src/Form/ModulesUninstallForm.php \Drupal\system\Form\ModulesUninstallForm::submitForm()
  2. 8.9.x core/modules/system/src/Form/ModulesUninstallForm.php \Drupal\system\Form\ModulesUninstallForm::submitForm()
  3. 11.x core/modules/system/src/Form/ModulesUninstallForm.php \Drupal\system\Form\ModulesUninstallForm::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/ModulesUninstallForm.php, line 231

Class

ModulesUninstallForm
Provides a form for uninstalling modules.

Namespace

Drupal\system\Form

Code

public function submitForm(array &$form, FormStateInterface $form_state) {
  // Save all the values in an expirable key value store.
  $modules = $form_state->getValue('uninstall');
  $uninstall = array_keys(array_filter($modules));
  $account = $this->currentUser()
    ->id();
  // Store the values for 6 hours. This expiration time is also used in
  // the form cache.
  $this->keyValueExpirable
    ->setWithExpire($account, $uninstall, 6 * 60 * 60);
  // Redirect to the confirm form.
  $form_state->setRedirect('system.modules_uninstall_confirm');
}

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