You are here

function easy_install_form_submit in Easy Install 8.3

Same name and namespace in other branches
  1. 8.9 easy_install.module \easy_install_form_submit()
  2. 8.10 easy_install.module \easy_install_form_submit()
  3. 8.2 easy_install.module \easy_install_form_submit()
  4. 8.4 easy_install.module \easy_install_form_submit()
  5. 8.5 easy_install.module \easy_install_form_submit()
  6. 8.6 easy_install.module \easy_install_form_submit()
  7. 8.7 easy_install.module \easy_install_form_submit()
  8. 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 69
Easy install 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);
  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);
}