public function DevelReinstall::submitForm in Devel 8
Same name and namespace in other branches
- 8.3 src/Form/DevelReinstall.php \Drupal\devel\Form\DevelReinstall::submitForm()
- 8.2 src/Form/DevelReinstall.php \Drupal\devel\Form\DevelReinstall::submitForm()
- 4.x src/Form/DevelReinstall.php \Drupal\devel\Form\DevelReinstall::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
- src/
Form/ DevelReinstall.php, line 141
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);
drupal_set_message($this
->t('Uninstalled and installed: %names.', array(
'%names' => implode(', ', $reinstall),
)));
} catch (\Exception $e) {
drupal_set_message($this
->t('Unable to reinstall modules. Error: %error.', array(
'%error' => $e
->getMessage(),
)), 'error');
}
}