From 14b6df455a9098353fc31c9c07a45a9edbf5beb2 Mon Sep 17 00:00:00 2001 From: bach Date: Mon, 19 Apr 2021 14:09:42 +0200 Subject: [PATCH] =?UTF-8?q?popsu=5Fmigrate:=20Created=20D7NodeProjet,=20D7?= =?UTF-8?q?NodeTheme=20themes=20et=20projets=20li=C3=A9s=20ok?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config/sync/core.extension.yml | 1 + config/sync/devel.settings.yml | 4 +- ...grate_plus.migration.d7_allpublicfiles.yml | 2 +- ...grate_plus.migration.d7_node_programme.yml | 2 +- .../migrate_plus.migration.d7_node_projet.yml | 39 ++ .../migrate_plus.migration.d7_node_theme.yml | 15 +- ....migration.d7_taxonomy_term_type_theme.yml | 2 +- .../sync/migrate_plus.migration.d7_users.yml | 2 +- .../migrate_plus.migration_group.popsu.yml | 2 +- config/sync/views.view.content.yml | 572 ++++++++++++++++++ .../migrate_plus.migration.d7_node_projet.yml | 45 ++ .../migrate_plus.migration.d7_node_theme.yml | 14 + .../Plugin/migrate/source/D7NodeProjet.php | 160 +++++ .../src/Plugin/migrate/source/D7NodeTheme.php | 21 + 14 files changed, 873 insertions(+), 8 deletions(-) create mode 100644 config/sync/migrate_plus.migration.d7_node_projet.yml create mode 100644 web/modules/custom/popsu_migrate/config/install/migrate_plus.migration.d7_node_projet.yml create mode 100644 web/modules/custom/popsu_migrate/src/Plugin/migrate/source/D7NodeProjet.php diff --git a/config/sync/core.extension.yml b/config/sync/core.extension.yml index 801bdf19..52913fe7 100644 --- a/config/sync/core.extension.yml +++ b/config/sync/core.extension.yml @@ -35,6 +35,7 @@ module: dblog: 0 devel: 0 devel_generate: 0 + devel_kint_extras: 0 dynamic_page_cache: 0 editor: 0 email_registration: 0 diff --git a/config/sync/devel.settings.yml b/config/sync/devel.settings.yml index f4726c2e..72026328 100644 --- a/config/sync/devel.settings.yml +++ b/config/sync/devel.settings.yml @@ -5,7 +5,9 @@ error_handlers: rebuild_theme: false debug_mail_file_format: '%to-%subject-%datetime.mail.txt' debug_mail_directory: 'temporary://devel-mails' -devel_dumper: default +devel_dumper: kint _core: default_config_hash: 8SYa5OOpQGdg4wnttb0LFNuG6GmivsS2qNv9sTH9gDI langcode: fr +debug_logfile: 'temporary://drupal_debug.txt' +debug_pre: false diff --git a/config/sync/migrate_plus.migration.d7_allpublicfiles.yml b/config/sync/migrate_plus.migration.d7_allpublicfiles.yml index 4d7598db..150a782d 100644 --- a/config/sync/migrate_plus.migration.d7_allpublicfiles.yml +++ b/config/sync/migrate_plus.migration.d7_allpublicfiles.yml @@ -1,4 +1,4 @@ -uuid: 48293cc8-6d3e-4319-94d5-5a084cc43922 +uuid: d8e55680-7f11-4e58-9e8a-892ec4ec9191 langcode: fr status: true dependencies: { } diff --git a/config/sync/migrate_plus.migration.d7_node_programme.yml b/config/sync/migrate_plus.migration.d7_node_programme.yml index e7c520a2..34a17135 100644 --- a/config/sync/migrate_plus.migration.d7_node_programme.yml +++ b/config/sync/migrate_plus.migration.d7_node_programme.yml @@ -1,4 +1,4 @@ -uuid: 6792e7bc-de9a-426f-a025-2714ebdae9c6 +uuid: b03a76ce-4cc8-4567-85f4-ec6740c3e47b langcode: fr status: true dependencies: { } diff --git a/config/sync/migrate_plus.migration.d7_node_projet.yml b/config/sync/migrate_plus.migration.d7_node_projet.yml new file mode 100644 index 00000000..6640a776 --- /dev/null +++ b/config/sync/migrate_plus.migration.d7_node_projet.yml @@ -0,0 +1,39 @@ +uuid: 3bbf9aad-5230-4660-8d1a-45d14b44a801 +langcode: fr +status: true +dependencies: { } +_core: + default_config_hash: 1F9ybTf9deXW-90QNi5lAFvj5IWLs7DuiZ5npJvkx68 +id: d7_node_projet +class: null +field_plugin_method: null +cck_plugin_method: null +migration_tags: + - 'Drupal 7' + - Content + - Popsu +migration_group: popsu +label: 'Node Projet' +source: + plugin: d7_node_projet + batch_size: 500 + high_water_property: + name: changed + alias: 'n' +process: + type: + plugin: default_value + default_value: projet + created: created + changed: changed + uid: + plugin: default_value + default_value: 34 + title: title +destination: + plugin: 'entity:node' +migration_dependencies: + required: + - d7_allpublicfiles + - d7_users + - d7_taxonomy_term_type_theme diff --git a/config/sync/migrate_plus.migration.d7_node_theme.yml b/config/sync/migrate_plus.migration.d7_node_theme.yml index c1616037..1114ac42 100644 --- a/config/sync/migrate_plus.migration.d7_node_theme.yml +++ b/config/sync/migrate_plus.migration.d7_node_theme.yml @@ -1,9 +1,9 @@ -uuid: da306ac3-31b7-48db-b5cd-bca61bed030d +uuid: 479b05a2-6377-46f9-976d-a4d79b4cc6ac langcode: fr status: true dependencies: { } _core: - default_config_hash: uXnA5dnBQRk7D5gA4_B-KY4azpiVJY8-B9E7aIwHb7A + default_config_hash: WJ4CqAlkn09bHQXqYqK8-kat9Esdlw-iXGRk0IeX97c id: d7_node_theme class: null field_plugin_method: null @@ -51,6 +51,17 @@ process: migration: d7_taxonomy_term_type_theme source: field_popsu_themtrans_type no_stub: true + field_themes_lies: + plugin: sub_process + source: field_themes_lies + process: + target_id: + plugin: migration_lookup + migration: + - d7_node_projet + - d7_node_theme + source: nid + stub_id: d7_node_projet destination: plugin: 'entity:node' migration_dependencies: diff --git a/config/sync/migrate_plus.migration.d7_taxonomy_term_type_theme.yml b/config/sync/migrate_plus.migration.d7_taxonomy_term_type_theme.yml index d5c3e37e..65ed4db1 100644 --- a/config/sync/migrate_plus.migration.d7_taxonomy_term_type_theme.yml +++ b/config/sync/migrate_plus.migration.d7_taxonomy_term_type_theme.yml @@ -1,4 +1,4 @@ -uuid: 5271f877-ecf0-43f0-8b85-935338468cb9 +uuid: b0b00974-3194-4e57-89b3-0cb83fd2d24f langcode: fr status: true dependencies: { } diff --git a/config/sync/migrate_plus.migration.d7_users.yml b/config/sync/migrate_plus.migration.d7_users.yml index cb893c41..5b40e134 100644 --- a/config/sync/migrate_plus.migration.d7_users.yml +++ b/config/sync/migrate_plus.migration.d7_users.yml @@ -1,4 +1,4 @@ -uuid: 7ec8eb78-7884-4c82-9996-ad70c1413c45 +uuid: 0ac95398-8da2-4e5a-968d-6db44f0b9b86 langcode: fr status: true dependencies: { } diff --git a/config/sync/migrate_plus.migration_group.popsu.yml b/config/sync/migrate_plus.migration_group.popsu.yml index 7ca2c662..fe4557dc 100644 --- a/config/sync/migrate_plus.migration_group.popsu.yml +++ b/config/sync/migrate_plus.migration_group.popsu.yml @@ -1,4 +1,4 @@ -uuid: 4723b02a-b61d-4833-bb03-b7a2dfa6b42e +uuid: 8d6222b6-cd0a-4679-b047-2ac9b3a079be langcode: fr status: true dependencies: diff --git a/config/sync/views.view.content.yml b/config/sync/views.view.content.yml index 9d9d86d4..a6be4c92 100644 --- a/config/sync/views.view.content.yml +++ b/config/sync/views.view.content.yml @@ -5,9 +5,11 @@ dependencies: config: - field.storage.node.field_image - field.storage.node.field_programme + - field.storage.node.field_themes_lies - field.storage.node.field_type_de_theme - image.style.thumbnail - node.type.programme + - node.type.projet - node.type.theme - taxonomy.vocabulary.types_de_theme module: @@ -691,10 +693,12 @@ display: defaults: filters: false filter_groups: false + title: false filter_groups: operator: AND groups: 1: AND + title: Programmes display_plugin: page display_title: Programmes id: page_1 @@ -987,6 +991,7 @@ display: filters: false filter_groups: false fields: false + title: false filter_groups: operator: AND groups: @@ -1268,6 +1273,69 @@ display: separator: ', ' field_api_classes: false plugin_id: field + field_themes_lies: + id: field_themes_lies + table: node__field_themes_lies + field: field_themes_lies + relationship: none + group_type: group + admin_label: '' + label: 'Thèmes liés' + exclude: false + alter: + alter_text: false + text: '' + make_link: false + path: '' + absolute: false + external: false + replace_spaces: false + path_case: none + trim_whitespace: false + alt: '' + rel: '' + link_class: '' + prefix: '' + suffix: '' + target: '' + nl2br: false + max_length: 0 + word_boundary: true + ellipsis: true + more_link: false + more_link_text: '' + more_link_path: '' + strip_tags: false + trim: false + preserve_tags: '' + html: false + element_type: '' + element_class: '' + element_label_type: '' + element_label_class: '' + element_label_colon: true + element_wrapper_type: '' + element_wrapper_class: '' + element_default_classes: true + empty: '' + hide_empty: false + empty_zero: false + hide_alter_empty: true + click_sort_column: target_id + type: entity_reference_label + settings: + link: true + group_column: target_id + group_columns: { } + group_rows: true + delta_limit: 0 + delta_offset: 0 + delta_reversed: false + delta_first_last: false + multi_type: separator + separator: ', ' + field_api_classes: false + plugin_id: field status: id: status table: node_field_data @@ -1312,6 +1380,7 @@ display: plugin_id: field entity_type: node entity_field: changed + title: Themes display_plugin: page display_title: Themes id: page_2 @@ -1329,4 +1398,507 @@ display: tags: - 'config:field.storage.node.field_image' - 'config:field.storage.node.field_programme' + - 'config:field.storage.node.field_themes_lies' - 'config:field.storage.node.field_type_de_theme' + page_3: + display_options: + path: admin/content/projets + menu: + type: tab + title: Projets + description: '' + expanded: false + parent: system.admin_content + weight: -10 + context: '0' + menu_name: admin + tab_options: + type: normal + title: Contenu + description: 'Trouver et gérer le contenu' + menu_name: admin + weight: -10 + display_extenders: + views_ef_fieldset: { } + display_description: '' + filters: + title: + id: title + table: node_field_data + field: title + relationship: none + group_type: group + admin_label: '' + operator: contains + value: '' + group: 1 + exposed: true + expose: + operator_id: title_op + label: Titre + description: '' + use_operator: false + operator: title_op + identifier: title + required: false + remember: false + multiple: false + remember_roles: + authenticated: authenticated + anonymous: '0' + administrator: '0' + operator_limit_selection: false + operator_list: { } + is_grouped: false + group_info: + label: '' + description: '' + identifier: '' + optional: true + widget: select + multiple: false + remember: false + default_group: All + default_group_multiple: { } + group_items: { } + plugin_id: string + entity_type: node + entity_field: title + type: + id: type + table: node_field_data + field: type + relationship: none + group_type: group + admin_label: '' + operator: in + value: + projet: projet + group: 1 + exposed: false + expose: + operator_id: type_op + label: 'Type de contenu' + description: '' + use_operator: false + operator: type_op + operator_limit_selection: false + operator_list: { } + identifier: type + required: false + remember: false + multiple: false + remember_roles: + authenticated: authenticated + anonymous: '0' + administrator: '0' + reduce: false + is_grouped: false + group_info: + label: '' + description: '' + identifier: '' + optional: true + widget: select + multiple: false + remember: false + default_group: All + default_group_multiple: { } + group_items: { } + plugin_id: bundle + entity_type: node + entity_field: type + status: + id: status + table: node_field_data + field: status + relationship: none + group_type: group + admin_label: '' + operator: '=' + value: '1' + group: 1 + exposed: true + expose: + operator_id: '' + label: État + description: '' + use_operator: false + operator: status_op + identifier: status + required: false + remember: false + multiple: false + remember_roles: + authenticated: authenticated + operator_limit_selection: false + operator_list: { } + is_grouped: true + group_info: + label: 'Statut de publication' + description: '' + identifier: status + optional: true + widget: select + multiple: false + remember: false + default_group: All + default_group_multiple: { } + group_items: + 1: + title: Publié + operator: '=' + value: '1' + 2: + title: 'Non publié' + operator: '=' + value: '0' + plugin_id: boolean + entity_type: node + entity_field: status + status_extra: + id: status_extra + table: node_field_data + field: status_extra + operator: '=' + value: false + plugin_id: node_status + group: 1 + entity_type: node + expose: + operator_limit_selection: false + operator_list: { } + field_programme_target_id: + id: field_programme_target_id + table: node__field_programme + field: field_programme_target_id + relationship: none + group_type: group + admin_label: '' + operator: '=' + value: + min: '' + max: '' + value: '' + group: 1 + exposed: true + expose: + operator_id: field_programme_target_id_op + label: 'Programme Popsu' + description: '' + use_operator: false + operator: field_programme_target_id_op + operator_limit_selection: false + operator_list: { } + identifier: field_programme_target_id + required: false + remember: false + multiple: false + remember_roles: + authenticated: authenticated + anonymous: '0' + admin: '0' + root: '0' + user: '0' + editeur: '0' + placeholder: '' + min_placeholder: '' + max_placeholder: '' + is_grouped: false + group_info: + label: '' + description: '' + identifier: '' + optional: true + widget: select + multiple: false + remember: false + default_group: All + default_group_multiple: { } + group_items: { } + plugin_id: numeric + defaults: + filters: false + filter_groups: false + fields: false + title: false + filter_groups: + operator: AND + groups: + 1: AND + fields: + node_bulk_form: + id: node_bulk_form + table: node + field: node_bulk_form + label: '' + exclude: false + alter: + alter_text: false + element_class: '' + element_default_classes: true + empty: '' + hide_empty: false + empty_zero: false + hide_alter_empty: true + plugin_id: node_bulk_form + entity_type: node + field_image: + id: field_image + table: node__field_image + field: field_image + relationship: none + group_type: group + admin_label: '' + label: Image + exclude: false + alter: + alter_text: false + text: '' + make_link: false + path: '' + absolute: false + external: false + replace_spaces: false + path_case: none + trim_whitespace: false + alt: '' + rel: '' + link_class: '' + prefix: '' + suffix: '' + target: '' + nl2br: false + max_length: 0 + word_boundary: true + ellipsis: true + more_link: false + more_link_text: '' + more_link_path: '' + strip_tags: false + trim: false + preserve_tags: '' + html: false + element_type: '' + element_class: '' + element_label_type: '' + element_label_class: '' + element_label_colon: false + element_wrapper_type: '' + element_wrapper_class: '' + element_default_classes: true + empty: '' + hide_empty: false + empty_zero: false + hide_alter_empty: true + click_sort_column: target_id + type: image + settings: + image_style: thumbnail + image_link: '' + group_column: '' + group_columns: { } + group_rows: true + delta_limit: 0 + delta_offset: 0 + delta_reversed: false + delta_first_last: false + multi_type: separator + separator: ', ' + field_api_classes: false + plugin_id: field + title: + id: title + table: node_field_data + field: title + label: Titre + exclude: false + alter: + alter_text: false + element_class: '' + element_default_classes: true + empty: '' + hide_empty: false + empty_zero: false + hide_alter_empty: true + entity_type: node + entity_field: title + type: string + settings: + link_to_entity: true + plugin_id: field + operations: + id: operations + table: node + field: operations + relationship: none + group_type: group + admin_label: '' + label: Actions + exclude: false + alter: + alter_text: false + text: '' + make_link: false + path: '' + absolute: false + external: false + replace_spaces: false + path_case: none + trim_whitespace: false + alt: '' + rel: '' + link_class: '' + prefix: '' + suffix: '' + target: '' + nl2br: false + max_length: 0 + word_boundary: true + ellipsis: true + more_link: false + more_link_text: '' + more_link_path: '' + strip_tags: false + trim: false + preserve_tags: '' + html: false + element_type: '' + element_class: '' + element_label_type: '' + element_label_class: '' + element_label_colon: true + element_wrapper_type: '' + element_wrapper_class: '' + element_default_classes: true + empty: '' + hide_empty: false + empty_zero: false + hide_alter_empty: true + destination: true + plugin_id: entity_operations + field_programme: + id: field_programme + table: node__field_programme + field: field_programme + relationship: none + group_type: group + admin_label: '' + label: 'Programme Popsu' + exclude: false + alter: + alter_text: false + text: '' + make_link: false + path: '' + absolute: false + external: false + replace_spaces: false + path_case: none + trim_whitespace: false + alt: '' + rel: '' + link_class: '' + prefix: '' + suffix: '' + target: '' + nl2br: false + max_length: 0 + word_boundary: true + ellipsis: true + more_link: false + more_link_text: '' + more_link_path: '' + strip_tags: false + trim: false + preserve_tags: '' + html: false + element_type: '' + element_class: '' + element_label_type: '' + element_label_class: '' + element_label_colon: true + element_wrapper_type: '' + element_wrapper_class: '' + element_default_classes: true + empty: '' + hide_empty: false + empty_zero: false + hide_alter_empty: true + click_sort_column: target_id + type: entity_reference_label + settings: + link: true + group_column: target_id + group_columns: { } + group_rows: true + delta_limit: 0 + delta_offset: 0 + delta_reversed: false + delta_first_last: false + multi_type: separator + separator: ', ' + field_api_classes: false + plugin_id: field + status: + id: status + table: node_field_data + field: status + label: État + exclude: false + alter: + alter_text: false + element_class: '' + element_default_classes: true + empty: '' + hide_empty: false + empty_zero: false + hide_alter_empty: true + type: boolean + settings: + format: custom + format_custom_true: Publié + format_custom_false: 'Non publié' + plugin_id: field + entity_type: node + entity_field: status + changed: + id: changed + table: node_field_data + field: changed + label: 'Mis à jour' + exclude: false + alter: + alter_text: false + element_class: '' + element_default_classes: true + empty: '' + hide_empty: false + empty_zero: false + hide_alter_empty: true + type: timestamp + settings: + date_format: short + custom_date_format: '' + timezone: '' + plugin_id: field + entity_type: node + entity_field: changed + title: Projets + display_plugin: page + display_title: Projets + id: page_3 + position: 1 + cache_metadata: + contexts: + - 'languages:language_content' + - 'languages:language_interface' + - url + - url.query_args + - user + - 'user.node_grants:view' + - user.permissions + max-age: 0 + tags: + - 'config:field.storage.node.field_image' + - 'config:field.storage.node.field_programme' diff --git a/web/modules/custom/popsu_migrate/config/install/migrate_plus.migration.d7_node_projet.yml b/web/modules/custom/popsu_migrate/config/install/migrate_plus.migration.d7_node_projet.yml new file mode 100644 index 00000000..51b5c7fd --- /dev/null +++ b/web/modules/custom/popsu_migrate/config/install/migrate_plus.migration.d7_node_projet.yml @@ -0,0 +1,45 @@ +id: d7_node_projet +label: Node Projet +migration_group: popsu +audit: true +migration_tags: + - Drupal 7 + - Content + - Popsu + +source: + plugin: d7_node_projet + batch_size: 500 + high_water_property: + name: changed + alias: n + +destination: + plugin: entity:node + +process: + # nid: nid + type: + plugin: default_value + default_value: projet + created: created + changed: changed + + uid: + plugin: default_value + default_value: 34 + + title: title + + # field_programme: + # plugin: migration_lookup + # migration: d7_node_programme + # source: programme + # no_stub: true + + +migration_dependencies: + required: + - d7_allpublicfiles + - d7_users + - d7_taxonomy_term_type_theme diff --git a/web/modules/custom/popsu_migrate/config/install/migrate_plus.migration.d7_node_theme.yml b/web/modules/custom/popsu_migrate/config/install/migrate_plus.migration.d7_node_theme.yml index f574e00a..9fb842ea 100644 --- a/web/modules/custom/popsu_migrate/config/install/migrate_plus.migration.d7_node_theme.yml +++ b/web/modules/custom/popsu_migrate/config/install/migrate_plus.migration.d7_node_theme.yml @@ -56,8 +56,22 @@ process: source: field_popsu_themtrans_type no_stub: true + field_themes_lies: + plugin: sub_process + source: field_themes_lies + process: + target_id: + plugin: migration_lookup + migration: + - d7_node_projet + - d7_node_theme + source: nid + # stub_id is not working :( + stub_id: d7_node_projet + migration_dependencies: required: - d7_allpublicfiles - d7_users - d7_taxonomy_term_type_theme + - d7_node_projet diff --git a/web/modules/custom/popsu_migrate/src/Plugin/migrate/source/D7NodeProjet.php b/web/modules/custom/popsu_migrate/src/Plugin/migrate/source/D7NodeProjet.php new file mode 100644 index 00000000..35f5052c --- /dev/null +++ b/web/modules/custom/popsu_migrate/src/Plugin/migrate/source/D7NodeProjet.php @@ -0,0 +1,160 @@ +moduleHandler = $module_handler; + $this->logger = $loggerFactory->get('popsu_migration'); + } + + /** + * {@inheritdoc} + */ + public static function create(ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition, MigrationInterface $migration = NULL) { + return new static( + $configuration, + $plugin_id, + $plugin_definition, + $migration, + $container->get('state'), + $container->get('entity_type.manager'), + $container->get('module_handler'), + $container->get('logger.factory') + ); + } + + /** + * The join options between the node and the node_revisions table. + */ + const JOIN = 'n.vid = nr.vid'; + + /** + * {@inheritdoc} + */ + public function query() { + // Select node in its last revision. + $query = $this->select('node_revision', 'nr') + ->fields('n', [ + 'nid', + 'type', + 'uid', + 'language', + 'status', + 'created', + 'changed', + ]) + ->fields('nr', [ + 'vid', + 'title', + 'log', + 'timestamp', + ]) + ->orderBy('changed'); + + $query->addField('n', 'uid', 'node_uid'); + $query->addField('nr', 'uid', 'revision_uid'); + $query->innerJoin('node', 'n', static::JOIN); + + $query->condition('n.type', ['popsu_ville', 'popsu_ville_europe', 'popsu_projet'], 'IN'); + + return $query; + } + + /** + * {@inheritdoc} + */ + public function prepareRow(Row $row) { + $nid = $row->getSourceProperty('nid'); + $vid = $row->getSourceProperty('vid'); + $type = $row->getSourceProperty('type'); + $title = $row->getSourceProperty('title'); + Drush::output()->writeln('- - - - ' . $title . '- - - - '); + + // Get Field API field values. + foreach ($this->getFields('node', $type) as $field_name => $field) { + $field_values = $this->getFieldValues('node', $field_name, $nid, $vid, NULL); + $row->setSourceProperty($field_name, $field_values); + // switch ($field_name) { + // case 'field_popsu_themloc_popsu': + // $field_programme = $field_values; + // break; + // } + } + + return parent::prepareRow($row); + } + + /** + * {@inheritdoc} + */ + public function fields() { + $fields = [ + 'nid' => $this->t('Node ID'), + 'type' => $this->t('Type'), + 'title' => $this->t('Title'), + 'node_uid' => $this->t('Node authored by (uid)'), + 'revision_uid' => $this->t('Revision authored by (uid)'), + 'created' => $this->t('Created timestamp'), + 'changed' => $this->t('Modified timestamp'), + 'status' => $this->t('Published'), + 'promote' => $this->t('Promoted to front page'), + 'sticky' => $this->t('Sticky at top of lists'), + 'revision' => $this->t('Create new revision'), + 'language' => $this->t('Language (fr, en, ...)'), + 'tnid' => $this->t('The translation set id for this node'), + 'timestamp' => $this->t('The timestamp the latest revision of this node was created.'), + ]; + return $fields; + } + + /** + * {@inheritdoc} + */ + public function getIds() { + $ids['nid']['type'] = 'integer'; + $ids['nid']['alias'] = 'n'; + return $ids; + } + +} diff --git a/web/modules/custom/popsu_migrate/src/Plugin/migrate/source/D7NodeTheme.php b/web/modules/custom/popsu_migrate/src/Plugin/migrate/source/D7NodeTheme.php index f52b9e73..547b2a32 100644 --- a/web/modules/custom/popsu_migrate/src/Plugin/migrate/source/D7NodeTheme.php +++ b/web/modules/custom/popsu_migrate/src/Plugin/migrate/source/D7NodeTheme.php @@ -160,11 +160,32 @@ class D7NodeTheme extends FieldableEntity { $row->setSourceProperty('programme', $prog[0]['nid']); } + # Images if ($field_images) { // Drush::output()->writeln(dump($field_images)); $row->setSourceProperty('images', $field_images); } + # Themes liés + // merge the two ppossible field source + $field_themes_lies = array(); + if ($field_popsu_themloc_lies = $row->getSourceProperty('field_popsu_themloc_lies')) { + // Drush::output()->writeln(dump($field_popsu_themloc_lies)); + foreach ($field_popsu_themloc_lies as $key => $value) { + $field_themes_lies[] = $value; + } + } + if ($field_popsu_themloc_comparatif = $row->getSourceProperty('field_popsu_themloc_comparatif')) { + // Drush::output()->writeln(dump($field_popsu_themloc_comparatif)); + foreach ($field_popsu_themloc_comparatif as $key => $value) { + $field_themes_lies[] = $value; + } + } + if (!empty($field_themes_lies)) { + Drush::output()->writeln(dump($field_themes_lies)); + $row->setSourceProperty('field_themes_lies', $field_themes_lies); + } + return parent::prepareRow($row); }