function ThemeUninstallConfirmForm::submitForm

Same name and namespace in other branches
  1. 11.x core/modules/system/src/Form/ThemeUninstallConfirmForm.php \Drupal\system\Form\ThemeUninstallConfirmForm::submitForm()

File

core/modules/system/src/Form/ThemeUninstallConfirmForm.php, line 142

Class

ThemeUninstallConfirmForm
Builds a confirmation form to uninstall a theme.

Namespace

Drupal\system\Form

Code

public function submitForm(array &$form, FormStateInterface $form_state) : void {
  $themes = $this->themeHandler
    ->listInfo();
  $theme = $form_state->getValue('theme');
  $this->themeInstaller
    ->uninstall([
    $form_state->getValue('theme'),
  ]);
  $this->messenger()
    ->addStatus($this->t('The %theme theme has been uninstalled.', [
    '%theme' => $themes[$theme]->info['name'],
  ]));
  $form_state->setRedirectUrl($this->getCancelUrl());
}

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