Issue #2991346 by alexpott: The message displayed by taxonomy_update_8601() should be overridable
parent
e742590eed
commit
237b3f4112
|
|
@ -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 @@ 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());
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
Loading…
Reference in New Issue