Skip to content
Snippets Groups Projects
Verified Commit 237b3f41 authored by Lee Rowlands's avatar Lee Rowlands
Browse files

Issue #2991346 by alexpott: The message displayed by taxonomy_update_8601() should be overridable

parent e742590e
No related branches found
No related tags found
No related merge requests found
......@@ -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.
......
......@@ -80,6 +80,13 @@ public function testPublishable() {
$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());
}
/**
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment