function easy_install_form_submit in Easy Install 8.9
Same name and namespace in other branches
- 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.6 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 102 - 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';
$ins_configs = $form_state
->getValue('configs') ? $form_state
->getValue('configs') : [];
if ($form_state
->getValue('ins_all_configs') != 0) {
foreach ($ins_configs as $key => $value) {
Drupal::configFactory()
->getEditable($key)
->delete();
}
$msg = 'The selected modules have been uninstalled and configurations
deleted';
}
else {
foreach ($ins_configs as $key => $values) {
if ($values !== 0) {
Drupal::configFactory()
->getEditable($key)
->delete();
$msg = 'The selected modules have been uninstalled and configurations
deleted';
}
}
}
$opt_configs = $form_state
->getValue('opt_configs') ? $form_state
->getValue('opt_configs') : [];
if ($form_state
->getValue('opt_all_configs') != 0) {
foreach ($opt_configs as $key => $value) {
Drupal::configFactory()
->getEditable($key)
->delete();
}
$msg = 'The selected modules have been uninstalled and configurations
deleted';
}
else {
foreach ($opt_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);
}