From cafd21cfd290ef2c9c485f7635dbf5550e402a16 Mon Sep 17 00:00:00 2001 From: Jacob Sanford Date: Thu, 11 Jul 2024 15:52:53 -0300 Subject: [PATCH] LOYALIST-58 Migrate body field using subprocess --- ...tion.0_loyalist_migrate_loyalist_items.yml | 26 +++++++++++++------ .../Plugin/migrate/source/LoyalistItem.php | 4 +-- 2 files changed, 19 insertions(+), 11 deletions(-) diff --git a/custom/modules/loyalist_migrate/config/install/migrate_plus.migration.0_loyalist_migrate_loyalist_items.yml b/custom/modules/loyalist_migrate/config/install/migrate_plus.migration.0_loyalist_migrate_loyalist_items.yml index c4e04ab..008f98f 100644 --- a/custom/modules/loyalist_migrate/config/install/migrate_plus.migration.0_loyalist_migrate_loyalist_items.yml +++ b/custom/modules/loyalist_migrate/config/install/migrate_plus.migration.0_loyalist_migrate_loyalist_items.yml @@ -35,14 +35,24 @@ process: bundle_key: vid bundle: subject_heading value_key: name - field_other_numbers/value: field_other_numbers_value - field_other_numbers/format: - plugin: default_value - default_value: 'wysiwyg' - body/value: body - body/format: - plugin: default_value - default_value: 'wysiwyg' + field_other_numbers: + - + plugin: sub_process + source: field_other_numbers_value + process: + value: value + format: + plugin: default_value + default_value: wysiwyg + body: + - + plugin: sub_process + source: body + process: + value: value + format: + plugin: default_value + default_value: wysiwyg destination: plugin: 'entity:node' diff --git a/custom/modules/loyalist_migrate/src/Plugin/migrate/source/LoyalistItem.php b/custom/modules/loyalist_migrate/src/Plugin/migrate/source/LoyalistItem.php index 14d89cc..f3a968d 100644 --- a/custom/modules/loyalist_migrate/src/Plugin/migrate/source/LoyalistItem.php +++ b/custom/modules/loyalist_migrate/src/Plugin/migrate/source/LoyalistItem.php @@ -34,7 +34,6 @@ public function query() $query->leftJoin('field_data_field_other_numbers', 'fon', 'n.nid = fon.entity_id AND fon.deleted = 0'); $query->addField('fon', 'field_other_numbers_value', 'field_other_numbers_value'); - $query->addField('fon', 'field_other_numbers_format', 'field_other_numbers_format'); $query->leftJoin('field_data_field_issuing_body', 'fib', 'n.nid = fib.entity_id AND fib.deleted = 0'); $query->leftJoin('taxonomy_term_data', 'ttdfib', 'fib.field_issuing_body_tid = ttdfib.tid'); @@ -57,13 +56,12 @@ public function fields() { // This maps the field from their name above to a destination field name that is specified in the process section. I generally keep them the same. $fields = [ - 'title' => 'title', 'nid' => 'nid', + 'title' => 'title', 'field_accompanying_record_value' => 'field_accompanying_record_value', 'issuing_body_name' => 'issuing_body_name', 'subject_heading_name' => 'subject_heading_name', 'field_other_numbers_value' => 'field_other_numbers_value', - 'field_other_numbers_format' => 'field_other_numbers_format', 'body' => 'body', ]; return $fields;