function easy_install_form_submit in Easy Install 8.6
Same name and namespace in other branches
- 8.9 easy_install.module \easy_install_form_submit()
- 8.10 easy_install.module \easy_install_form_submit()
- 8.2 easy_install.module \easy_install_form_submit()
- 8.3 easy_install.module \easy_install_form_submit()
- 8.4 easy_install.module \easy_install_form_submit()
- 8.5 easy_install.module \easy_install_form_submit()
- 8.7 easy_install.module \easy_install_form_submit()
- 8.8 easy_install.module \easy_install_form_submit()
Implements custom submit().
1 string reference to 'easy_install_form_submit'
- easy_install_form_alter in ./
easy_install.module - Implements hook_form_alter().
File
- ./
easy_install.module, line 66 - Easy uninstall module file.
Code
function easy_install_form_submit(array $form, FormStateInterface $form_state) {
$account = \Drupal::currentUser()
->id();
$modules_list = \Drupal::service('keyvalue.expirable')
->get('modules_uninstall');
$modules = $modules_list
->get($account);
$module_handler = \Drupal::service('module_installer');
$module_handler
->uninstall($modules);
$modules_list
->delete($account);
$msg = 'The selected modules have been uninstalled';
if ($form_state
->getValue('all_configs') != 0) {
foreach ($form_state
->getValue('configs') as $key => $value) {
Drupal::configFactory()
->getEditable($key)
->delete();
}
$msg = 'The selected modules have been uninstalled and configurations
deleted';
}
else {
foreach ($form_state
->getValue('configs') as $key => $values) {
if ($values != 0) {
Drupal::configFactory()
->getEditable($key)
->delete();
$msg = 'The selected modules have been uninstalled and configurations
deleted';
}
}
}
drupal_set_message(t('@msg', [
'@msg' => $msg,
]));
$redirect = new Url('system.modules_uninstall');
$form_state
->setRedirectUrl($redirect);
}