/**
  * {@inheritdoc}
  */
 public function submitForm(array &$form, FormStateInterface $form_state)
 {
     // Clear the key value store entry.
     $account = $this->currentUser()->id();
     $this->keyValueExpirable->delete($account);
     // Uninstall the modules.
     $this->moduleInstaller->uninstall($this->modules);
     drupal_set_message($this->t('The selected modules have been uninstalled.'));
     $form_state->setRedirectUrl($this->getCancelUrl());
 }
예제 #2
0
 /**
  * {@inheritdoc}
  */
 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');
     }
 }