summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLee Rowlands2018-08-09 21:10:38 (GMT)
committerLee Rowlands2018-08-09 21:12:57 (GMT)
commit4e87836d9dead02f0ab11655fbe1752f4a26879b (patch)
treec4d6537bf274b39fc8505c6e4353523cc4f8af4f
parent058f3387d788576022c7a67589adce33428b382d (diff)
Issue #2991346 by alexpott: The message displayed by taxonomy_update_8601() should be overridable
(cherry picked from commit 237b3f4112b9f66324518875ddd73b34ce6077b1)
-rw-r--r--core/modules/taxonomy/taxonomy.install5
-rw-r--r--core/modules/taxonomy/tests/src/Functional/Update/TaxonomyTermUpdatePathTest.php7
2 files changed, 10 insertions, 2 deletions
diff --git a/core/modules/taxonomy/taxonomy.install b/core/modules/taxonomy/taxonomy.install
index c0e292d..143962f 100644
--- a/core/modules/taxonomy/taxonomy.install
+++ b/core/modules/taxonomy/taxonomy.install
@@ -138,9 +138,10 @@ function taxonomy_update_8601() {
// 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 <strong>not</strong> been added to taxonomy terms. See <a href=":link">this page</a> for more information on how to install it.', [
+ $message = \Drupal::state()->get('taxonomy_update_8601_skip_message', t('The publishing status field has <strong>not</strong> been added to taxonomy terms. See <a href=":link">this page</a> for more information on how to install it.', [
':link' => 'https://www.drupal.org/node/2985366',
- ]);
+ ]));
+ return $message;
}
// Add the 'published' entity key to the taxonomy_term entity type.
diff --git a/core/modules/taxonomy/tests/src/Functional/Update/TaxonomyTermUpdatePathTest.php b/core/modules/taxonomy/tests/src/Functional/Update/TaxonomyTermUpdatePathTest.php
index 87ad2a7..55f1491 100644
--- a/core/modules/taxonomy/tests/src/Functional/Update/TaxonomyTermUpdatePathTest.php
+++ b/core/modules/taxonomy/tests/src/Functional/Update/TaxonomyTermUpdatePathTest.php
@@ -80,6 +80,13 @@ class TaxonomyTermUpdatePathTest extends UpdatePathTestBase {
$term->save();
$term = $storage->loadUnchanged($term->id());
$this->assertFalse($term->isPublished());
+
+ // Test the update does not run when a status field already exists.
+ module_load_install('taxonomy');
+ $this->assertEquals('The publishing status field has <strong>not</strong> been added to taxonomy terms. See <a href="https://www.drupal.org/node/2985366">this page</a> for more information on how to install it.', (string) taxonomy_update_8601());
+ // Test the message can be overridden.
+ \Drupal::state()->set('taxonomy_update_8601_skip_message', 'Another message');
+ $this->assertEquals('Another message', (string) taxonomy_update_8601());
}
/**