diff --git a/core/modules/comment/lib/Drupal/comment/Tests/CommentFieldsTest.php b/core/modules/comment/lib/Drupal/comment/Tests/CommentFieldsTest.php index 4c173f9..10c8f80 100644 --- a/core/modules/comment/lib/Drupal/comment/Tests/CommentFieldsTest.php +++ b/core/modules/comment/lib/Drupal/comment/Tests/CommentFieldsTest.php @@ -86,7 +86,6 @@ function testCommentInstallAfterContentModule() { field_purge_batch(10); // Disable the comment module. - entity_load('field_instance', 'comment.node__comment.comment_body')->delete(); $edit = array(); $edit['uninstall[comment]'] = TRUE; $this->drupalPostForm('admin/modules/uninstall', $edit, t('Uninstall')); diff --git a/core/modules/field/field.module b/core/modules/field/field.module index bc6e143..eb5c529 100644 --- a/core/modules/field/field.module +++ b/core/modules/field/field.module @@ -282,16 +282,16 @@ function field_modules_installed($modules) { * Implements hook_module_preuninstall(). */ function field_module_preuninstall($module) { - $enitty_type_ids = array(); + $entity_type_ids = array(); $entity_types = \Drupal::entityManager()->getDefinitions(); foreach ($entity_types as $entity_type) { if ($entity_type->getProvider() == $module) { - $enitty_type_ids[] = $entity_type->id(); + $entity_type_ids[] = $entity_type->id(); } } - if ($enitty_type_ids) { + if ($entity_type_ids) { $fields = \Drupal::entityQuery('field_instance_config') - ->condition('entity_type', $enitty_type_ids) + ->condition('entity_type', $entity_type_ids) ->execute(); if ($fields) { throw new \Exception("If you don't eat yer meat, you can't have any pudding"); diff --git a/core/modules/forum/forum.install b/core/modules/forum/forum.install index 0642db7..ec10bc5 100644 --- a/core/modules/forum/forum.install +++ b/core/modules/forum/forum.install @@ -103,6 +103,10 @@ function forum_uninstall() { $field->delete(); } + if ($field = field_info_field('comment', 'comment_body')) { + $field->delete(); + } + // Purge field data now to allow taxonomy and options module to be uninstalled // if this is the only field remaining. We need to run it twice because // field_purge_batch() will not remove the instance and the field in the same diff --git a/core/modules/system/lib/Drupal/system/Tests/Module/DependencyTest.php b/core/modules/system/lib/Drupal/system/Tests/Module/DependencyTest.php index 3ddf40a..907741e 100644 --- a/core/modules/system/lib/Drupal/system/Tests/Module/DependencyTest.php +++ b/core/modules/system/lib/Drupal/system/Tests/Module/DependencyTest.php @@ -179,7 +179,6 @@ function testUninstallDependents() { $this->assertText(t('The selected modules have been uninstalled.'), 'Modules status has been updated.'); // Uninstall comment module. - entity_load('field_instance', 'comment.node__comment_forum.comment_body')->delete(); $edit = array('uninstall[comment]' => 'comment'); $this->drupalPostForm('admin/modules/uninstall', $edit, t('Uninstall')); $this->drupalPostForm(NULL, NULL, t('Uninstall')); diff --git a/core/modules/system/lib/Drupal/system/Tests/Module/ModuleApiTest.php b/core/modules/system/lib/Drupal/system/Tests/Module/ModuleApiTest.php index b7fa8d6..d5650e5 100644 --- a/core/modules/system/lib/Drupal/system/Tests/Module/ModuleApiTest.php +++ b/core/modules/system/lib/Drupal/system/Tests/Module/ModuleApiTest.php @@ -186,8 +186,6 @@ function testDependencyResolution() { // Uninstall the profile module from above, and make sure that the profile // itself is not on the list of dependent modules to be uninstalled. - entity_load('field_instance', 'comment.node__comment.comment_body')->delete(); - entity_load('field_instance', 'comment.node__comment_forum.comment_body')->delete(); $result = module_uninstall(array('comment')); $this->assertTrue($result, 'module_uninstall() returns the correct value.'); $this->assertEqual(drupal_get_installed_schema_version('comment'), SCHEMA_UNINSTALLED, 'Comment module was uninstalled.');