function easy_uninstall_form_submit in Easy Install 8
Implements custom submit().
1 string reference to 'easy_uninstall_form_submit'
- easy_uninstall_form_alter in ./
easy_uninstall.module  - Implements hook_form_alter().
 
File
- ./
easy_uninstall.module, line 71  - Easy uninstall module file.
 
Code
function easy_uninstall_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);
  if ($form_state
    ->getValue('all_configs')) {
    foreach ($form_state
      ->getValues('configs') as $key => $value) {
      Drupal::configFactory()
        ->getEditable($key)
        ->delete();
    }
  }
  else {
    foreach ($form_state
      ->getValues('configs') as $key => $values) {
      if ($values) {
        Drupal::configFactory()
          ->getEditable($key)
          ->delete();
      }
    }
  }
  drupal_set_message(t('The selected modules have been uninstalled and configurations deleted'));
  $redirect = new Url('system.modules_uninstall');
  $form_state
    ->setRedirectUrl($redirect);
}