/** * {@inheritdoc} */ public function submitForm(array &$form, FormStateInterface $form_state) { $modules = array_filter($form_state['values']['list']); $this->moduleHandler->uninstall($modules, FALSE); $this->moduleHandler->install($modules, FALSE); drupal_set_message(t('Uninstalled and installed: %names.', array('%names' => implode(', ', $modules)))); }
/** * Tests the custom bundle field creation and deletion. */ public function testCustomBundleFieldCreateDelete() { // Install the module which adds the field. $this->moduleHandler->install(array('entity_bundle_field_test'), FALSE); $definition = $this->entityManager->getFieldDefinitions('entity_test', 'custom')['custom_field']; $this->assertNotNull($definition, 'Field definition found.'); // Make sure the table has been created. $table = $this->entityManager->getStorage('entity_test')->_fieldTableName($definition); $this->assertTrue($this->database->schema()->tableExists($table), 'Table created'); $this->moduleHandler->uninstall(array('entity_bundle_field_test'), FALSE); $this->assertFalse($this->database->schema()->tableExists($table), 'Table dropped'); }
/** * {@inheritdoc} */ public function submitForm(array &$form, array &$form_state) { // Clear the key value store entry. $account = $this->currentUser()->id(); $this->keyValueExpirable->delete($account); // Uninstall the modules. $this->moduleHandler->uninstall($this->modules); drupal_set_message($this->t('The selected modules have been uninstalled.')); $form_state['redirect_route'] = $this->getCancelRoute(); }