function DevelReinstall::submitForm
Same name in other branches
- 5.x src/Form/DevelReinstall.php \Drupal\devel\Form\DevelReinstall::submitForm()
Overrides FormInterface::submitForm
File
-
src/
Form/ DevelReinstall.php, line 153
Class
- DevelReinstall
- Display a dropdown of installed modules with the option to reinstall them.
Namespace
Drupal\devel\FormCode
public function submitForm(array &$form, FormStateInterface $form_state) {
try {
$modules = $form_state->getValue('reinstall');
$reinstall = array_keys(array_filter($modules));
$this->moduleInstaller
->uninstall($reinstall, FALSE);
$this->moduleInstaller
->install($reinstall, FALSE);
$this->messenger()
->addMessage($this->t('Uninstalled and installed: %names.', [
'%names' => implode(', ', $reinstall),
]));
} catch (\Exception $e) {
$this->messenger()
->addError($this->t('Unable to reinstall modules. Error: %error.', [
'%error' => $e->getMessage(),
]));
}
}