From c2ea8a58aaf32cd2b21207bf8aadfed9ae9eb482 Mon Sep 17 00:00:00 2001 From: webchick Date: Fri, 20 Dec 2019 17:49:09 -0800 Subject: [PATCH] Issue #3097327 by Wim Leers, quietone, Meenakshi.g: d7_node_title_label migration plugin incorrectly generating base_field_override for every node type, even those that don't have an overridden title label --- .../tests/src/Functional/d7/Upgrade7Test.php | 2 +- .../node/migrations/d7_node_title_label.yml | 11 ++++++++++- .../Migrate/d7/MigrateNodeTitleLabelTest.php | 18 +++++++++++++----- 3 files changed, 24 insertions(+), 7 deletions(-) diff --git a/core/modules/migrate_drupal_ui/tests/src/Functional/d7/Upgrade7Test.php b/core/modules/migrate_drupal_ui/tests/src/Functional/d7/Upgrade7Test.php index 5cde04e322c..ba16905e729 100644 --- a/core/modules/migrate_drupal_ui/tests/src/Functional/d7/Upgrade7Test.php +++ b/core/modules/migrate_drupal_ui/tests/src/Functional/d7/Upgrade7Test.php @@ -101,7 +101,7 @@ class Upgrade7Test extends MigrateUpgradeExecuteTestBase { 'entity_form_mode' => 1, 'entity_view_display' => 31, 'entity_view_mode' => 14, - 'base_field_override' => 9, + 'base_field_override' => 4, ]; } diff --git a/core/modules/node/migrations/d7_node_title_label.yml b/core/modules/node/migrations/d7_node_title_label.yml index 9b3051ade61..625b392a79f 100644 --- a/core/modules/node/migrations/d7_node_title_label.yml +++ b/core/modules/node/migrations/d7_node_title_label.yml @@ -9,10 +9,19 @@ source: entity_type: node field_name: title process: + label: + - + plugin: static_map + source: title_label + bypass: true + map: + Title: 0 + - + plugin: skip_on_empty + method: row entity_type: 'constants/entity_type' bundle: type field_name: 'constants/field_name' - label: title_label destination: plugin: entity:base_field_override migration_dependencies: diff --git a/core/modules/node/tests/src/Kernel/Migrate/d7/MigrateNodeTitleLabelTest.php b/core/modules/node/tests/src/Kernel/Migrate/d7/MigrateNodeTitleLabelTest.php index fcf231b7e7a..5bb2f1a31fe 100644 --- a/core/modules/node/tests/src/Kernel/Migrate/d7/MigrateNodeTitleLabelTest.php +++ b/core/modules/node/tests/src/Kernel/Migrate/d7/MigrateNodeTitleLabelTest.php @@ -42,12 +42,20 @@ class MigrateNodeTitleLabelTest extends MigrateDrupal7TestBase { * Tests migration of node title field overrides. */ public function testMigration() { - $this->assertEntity('node.article.title', 'Title'); - $this->assertEntity('node.blog.title', 'Title'); - $this->assertEntity('node.book.title', 'Title'); + // Forum title labels are overridden to 'Subject'. $this->assertEntity('node.forum.title', 'Subject'); - $this->assertEntity('node.page.title', 'Title'); - $this->assertEntity('node.test_content_type.title', 'Title'); + // Other content types use the default of 'Title' and are not overridden. + $no_override_node_type = [ + 'article', + 'blog', + 'book', + 'page', + 'test_content_type', + ]; + foreach ($no_override_node_type as $type) { + $override = BaseFieldOverride::load("node.$type.title"); + $this->assertFalse($override instanceof BaseFieldOverride); + } } }