diff --git a/core/modules/taxonomy/taxonomy.install b/core/modules/taxonomy/taxonomy.install index 3c3cd2c..c0e292d 100644 --- a/core/modules/taxonomy/taxonomy.install +++ b/core/modules/taxonomy/taxonomy.install @@ -136,6 +136,13 @@ function taxonomy_update_8601() { $definition_update_manager = \Drupal::entityDefinitionUpdateManager(); $entity_type = $definition_update_manager->getEntityType('taxonomy_term'); + // Bail out early if a field named 'status' is already installed. + if ($definition_update_manager->getFieldStorageDefinition('status', 'taxonomy_term')) { + return t('The publishing status field has not been added to taxonomy terms. See this page for more information on how to install it.', [ + ':link' => 'https://www.drupal.org/node/2985366', + ]); + } + // Add the 'published' entity key to the taxonomy_term entity type. $entity_keys = $entity_type->getKeys(); $entity_keys['published'] = 'status'; diff --git a/core/modules/taxonomy/tests/src/Functional/Update/TaxonomyTermUpdatePathTest.php b/core/modules/taxonomy/tests/src/Functional/Update/TaxonomyTermUpdatePathTest.php index b96da8b..87ad2a7 100644 --- a/core/modules/taxonomy/tests/src/Functional/Update/TaxonomyTermUpdatePathTest.php +++ b/core/modules/taxonomy/tests/src/Functional/Update/TaxonomyTermUpdatePathTest.php @@ -74,6 +74,12 @@ public function testPublishable() { $this->assertEquals('Test term', $term->label()); $this->assertEquals('tags', $term->bundle()); $this->assertTrue($term->isPublished()); + + // Check that the term can be unpublished. + $term->setUnpublished(); + $term->save(); + $term = $storage->loadUnchanged($term->id()); + $this->assertFalse($term->isPublished()); } /**