From e9710fd8b147c1b95025b9c3c1fd91ec1eb2cc26 Mon Sep 17 00:00:00 2001 From: bach Date: Tue, 20 Apr 2021 15:21:09 +0200 Subject: [PATCH] popsu_migrate: D7NodeRessource title, programme, projet, theme, poid ok --- ...ty_form_display.node.ressource.default.yml | 21 +- ...ty_view_display.node.ressource.default.yml | 18 + ...ity_view_display.node.ressource.teaser.yml | 4 + .../field.field.node.ressource.field_memo.yml | 19 + .../field.field.node.ressource.field_poid.yml | 25 + ...grate_plus.migration.d7_allpublicfiles.yml | 2 +- ...grate_plus.migration.d7_node_programme.yml | 2 +- .../migrate_plus.migration.d7_node_projet.yml | 2 +- ...grate_plus.migration.d7_node_ressource.yml | 57 ++ .../migrate_plus.migration.d7_node_static.yml | 2 +- .../migrate_plus.migration.d7_node_theme.yml | 2 +- ....migration.d7_taxonomy_term_type_theme.yml | 2 +- ..._plus.migration.d7_taxonomy_term_ville.yml | 2 +- .../sync/migrate_plus.migration.d7_users.yml | 2 +- .../migrate_plus.migration_group.popsu.yml | 2 +- config/sync/views.view.content.yml | 852 +++++++++++++++++- ...grate_plus.migration.d7_node_ressource.yml | 84 ++ .../Plugin/migrate/source/D7NodeRessource.php | 259 ++++++ 18 files changed, 1335 insertions(+), 22 deletions(-) create mode 100644 config/sync/field.field.node.ressource.field_memo.yml create mode 100644 config/sync/field.field.node.ressource.field_poid.yml create mode 100644 config/sync/migrate_plus.migration.d7_node_ressource.yml create mode 100644 web/modules/custom/popsu_migrate/config/install/migrate_plus.migration.d7_node_ressource.yml create mode 100644 web/modules/custom/popsu_migrate/src/Plugin/migrate/source/D7NodeRessource.php diff --git a/config/sync/core.entity_form_display.node.ressource.default.yml b/config/sync/core.entity_form_display.node.ressource.default.yml index 2bff9594..a44e7d2c 100644 --- a/config/sync/core.entity_form_display.node.ressource.default.yml +++ b/config/sync/core.entity_form_display.node.ressource.default.yml @@ -11,6 +11,8 @@ dependencies: - field.field.node.ressource.field_fichier - field.field.node.ressource.field_image - field.field.node.ressource.field_lien + - field.field.node.ressource.field_memo + - field.field.node.ressource.field_poid - field.field.node.ressource.field_programme - field.field.node.ressource.field_projet - field.field.node.ressource.field_ressources_liees @@ -130,6 +132,8 @@ third_party_settings: children: - status - promote + - field_poid + - field_memo parent_name: '' weight: 20 format_type: details_sidebar @@ -212,6 +216,21 @@ content: third_party_settings: { } type: link_default region: content + field_memo: + weight: 3 + settings: + rows: 5 + placeholder: '' + third_party_settings: { } + type: string_textarea + region: content + field_poid: + weight: 2 + settings: + placeholder: '' + third_party_settings: { } + type: number + region: content field_programme: weight: -20 settings: @@ -278,7 +297,7 @@ content: region: content promote: type: boolean_checkbox - weight: 0 + weight: 1 region: content settings: display_label: true diff --git a/config/sync/core.entity_view_display.node.ressource.default.yml b/config/sync/core.entity_view_display.node.ressource.default.yml index c4f69ebc..feed6719 100644 --- a/config/sync/core.entity_view_display.node.ressource.default.yml +++ b/config/sync/core.entity_view_display.node.ressource.default.yml @@ -11,6 +11,8 @@ dependencies: - field.field.node.ressource.field_fichier - field.field.node.ressource.field_image - field.field.node.ressource.field_lien + - field.field.node.ressource.field_memo + - field.field.node.ressource.field_poid - field.field.node.ressource.field_programme - field.field.node.ressource.field_projet - field.field.node.ressource.field_ressources_liees @@ -99,6 +101,22 @@ content: third_party_settings: { } type: link region: content + field_memo: + weight: 118 + label: above + settings: { } + third_party_settings: { } + type: basic_string + region: content + field_poid: + weight: 119 + label: above + settings: + thousand_separator: '' + prefix_suffix: true + third_party_settings: { } + type: number_integer + region: content field_programme: weight: 102 label: above diff --git a/config/sync/core.entity_view_display.node.ressource.teaser.yml b/config/sync/core.entity_view_display.node.ressource.teaser.yml index 97dae13e..0cc587c1 100644 --- a/config/sync/core.entity_view_display.node.ressource.teaser.yml +++ b/config/sync/core.entity_view_display.node.ressource.teaser.yml @@ -12,6 +12,8 @@ dependencies: - field.field.node.ressource.field_fichier - field.field.node.ressource.field_image - field.field.node.ressource.field_lien + - field.field.node.ressource.field_memo + - field.field.node.ressource.field_poid - field.field.node.ressource.field_programme - field.field.node.ressource.field_projet - field.field.node.ressource.field_ressources_liees @@ -49,6 +51,8 @@ hidden: field_fichier: true field_image: true field_lien: true + field_memo: true + field_poid: true field_programme: true field_projet: true field_ressources_liees: true diff --git a/config/sync/field.field.node.ressource.field_memo.yml b/config/sync/field.field.node.ressource.field_memo.yml new file mode 100644 index 00000000..5352f14f --- /dev/null +++ b/config/sync/field.field.node.ressource.field_memo.yml @@ -0,0 +1,19 @@ +uuid: 995ce745-a5ed-4d80-bee7-1f63fb253e63 +langcode: fr +status: true +dependencies: + config: + - field.storage.node.field_memo + - node.type.ressource +id: node.ressource.field_memo +field_name: field_memo +entity_type: node +bundle: ressource +label: memo +description: '' +required: false +translatable: true +default_value: { } +default_value_callback: '' +settings: { } +field_type: string_long diff --git a/config/sync/field.field.node.ressource.field_poid.yml b/config/sync/field.field.node.ressource.field_poid.yml new file mode 100644 index 00000000..7d5cc133 --- /dev/null +++ b/config/sync/field.field.node.ressource.field_poid.yml @@ -0,0 +1,25 @@ +uuid: 10ba7c10-470c-4fa3-a41b-af3955bf77ea +langcode: fr +status: true +dependencies: + config: + - field.storage.node.field_poid + - node.type.ressource +id: node.ressource.field_poid +field_name: field_poid +entity_type: node +bundle: ressource +label: Poid +description: '' +required: false +translatable: true +default_value: + - + value: 0 +default_value_callback: '' +settings: + min: -20 + max: 20 + prefix: '' + suffix: '' +field_type: integer diff --git a/config/sync/migrate_plus.migration.d7_allpublicfiles.yml b/config/sync/migrate_plus.migration.d7_allpublicfiles.yml index 09761c38..4f4a722b 100644 --- a/config/sync/migrate_plus.migration.d7_allpublicfiles.yml +++ b/config/sync/migrate_plus.migration.d7_allpublicfiles.yml @@ -1,4 +1,4 @@ -uuid: e1cf47fe-1b42-4c9a-a3f9-80e79bac0005 +uuid: 10b75e27-fd9a-41e6-96d2-6cda8f4e51c0 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 4ea29a44..484e21a6 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: b45c0dd4-f26e-46cc-b7bd-15ad9bcee8b1 +uuid: e3cc92c5-b0ab-4080-af72-c85263400cd2 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 index 240b19b1..59f7bb80 100644 --- a/config/sync/migrate_plus.migration.d7_node_projet.yml +++ b/config/sync/migrate_plus.migration.d7_node_projet.yml @@ -1,4 +1,4 @@ -uuid: df23e80f-3155-40c8-87cf-c345ad055d9d +uuid: 21b27148-dd80-4f6d-89e3-0e2ac273fcaa langcode: fr status: true dependencies: { } diff --git a/config/sync/migrate_plus.migration.d7_node_ressource.yml b/config/sync/migrate_plus.migration.d7_node_ressource.yml new file mode 100644 index 00000000..8447f12c --- /dev/null +++ b/config/sync/migrate_plus.migration.d7_node_ressource.yml @@ -0,0 +1,57 @@ +uuid: c56ee3c4-8f8c-4db9-8d4e-3e561717a77a +langcode: fr +status: true +dependencies: { } +_core: + default_config_hash: vLP1_Cnin9Yl02tpBgcYRMk7JrLOJRChR8FvtW1nrXo +id: d7_node_ressource +class: null +field_plugin_method: null +cck_plugin_method: null +migration_tags: + - 'Drupal 7' + - Content + - Popsu +migration_group: popsu +label: 'Node Ressource' +source: + plugin: d7_node_ressource + batch_size: 500 +process: + type: + plugin: default_value + default_value: ressource + created: created + changed: changed + uid: + plugin: default_value + default_value: 34 + title: title + field_programme: + plugin: sub_process + source: field_programme + process: + target_id: + plugin: migration_lookup + migration: d7_node_programme + source: nid + no_stub: true + field_theme: + plugin: migration_lookup + migration: d7_node_theme + source: field_theme + no_stub: true + field_projet: + plugin: migration_lookup + migration: d7_node_projet + source: field_projet + no_stub: true + field_poid: field_poids + field_memo: field_memo +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_static.yml b/config/sync/migrate_plus.migration.d7_node_static.yml index 6f556060..64c45b22 100644 --- a/config/sync/migrate_plus.migration.d7_node_static.yml +++ b/config/sync/migrate_plus.migration.d7_node_static.yml @@ -1,4 +1,4 @@ -uuid: 28dfe1fe-90b9-4311-a46e-3ec3dbbd0053 +uuid: cad96842-81a6-4933-bc39-8b5d8068e552 langcode: fr status: true dependencies: { } diff --git a/config/sync/migrate_plus.migration.d7_node_theme.yml b/config/sync/migrate_plus.migration.d7_node_theme.yml index 15e85d74..99bcfbdd 100644 --- a/config/sync/migrate_plus.migration.d7_node_theme.yml +++ b/config/sync/migrate_plus.migration.d7_node_theme.yml @@ -1,4 +1,4 @@ -uuid: 83bd4f30-716c-4ae8-918b-55bb56e0ea2e +uuid: 2cb0a4dd-17f3-4e91-b0c4-a7d30e2529eb langcode: fr status: true 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 c94554cc..f148bc7f 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: 6d30ad1d-8450-451f-be72-efdae5dfb3c4 +uuid: 0b1298bd-70ab-4250-9c98-0efbe6275ab2 langcode: fr status: true dependencies: { } diff --git a/config/sync/migrate_plus.migration.d7_taxonomy_term_ville.yml b/config/sync/migrate_plus.migration.d7_taxonomy_term_ville.yml index a0a16518..a4e146fc 100644 --- a/config/sync/migrate_plus.migration.d7_taxonomy_term_ville.yml +++ b/config/sync/migrate_plus.migration.d7_taxonomy_term_ville.yml @@ -1,4 +1,4 @@ -uuid: 55c6fb53-6dac-4ec7-a0f8-3f9655b0b1e4 +uuid: 2ee1b95e-6eeb-403e-84ec-8075e4ab2618 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 299f8635..43320860 100644 --- a/config/sync/migrate_plus.migration.d7_users.yml +++ b/config/sync/migrate_plus.migration.d7_users.yml @@ -1,4 +1,4 @@ -uuid: 16730dbd-d94c-4962-ac1b-9acc603b7e8d +uuid: 9df858db-e8e2-4ae2-adaf-a16ac2308ebb 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 ce19a28c..edc3f942 100644 --- a/config/sync/migrate_plus.migration_group.popsu.yml +++ b/config/sync/migrate_plus.migration_group.popsu.yml @@ -1,4 +1,4 @@ -uuid: beb0c7e2-2ff3-4eef-a325-aa30360a6817 +uuid: 538e8fb8-91d7-4410-8d7f-5da0aa398302 langcode: fr status: true dependencies: diff --git a/config/sync/views.view.content.yml b/config/sync/views.view.content.yml index ed787327..10f6d94f 100644 --- a/config/sync/views.view.content.yml +++ b/config/sync/views.view.content.yml @@ -8,14 +8,18 @@ dependencies: - field.storage.node.field_image - field.storage.node.field_memo - field.storage.node.field_partenaires + - field.storage.node.field_poid - field.storage.node.field_programme + - field.storage.node.field_projet - field.storage.node.field_projets_lies + - field.storage.node.field_theme - field.storage.node.field_themes_lies - field.storage.node.field_type_de_theme - field.storage.node.field_ville - image.style.thumbnail - node.type.programme - node.type.projet + - node.type.ressource - node.type.static - node.type.theme - taxonomy.vocabulary.types_de_theme @@ -78,22 +82,23 @@ display: description: '' columns: node_bulk_form: node_bulk_form - field_image: field_image + field_diaporama: field_diaporama title: title - field_type_de_theme: title operations: title field_programme: field_programme + field_projet: field_projet + field_theme: field_theme + field_poid: field_poid status: status changed: changed + field_memo: field_memo info: node_bulk_form: align: '' separator: '' empty_column: false responsive: '' - field_image: - sortable: false - default_sort_order: asc + field_diaporama: align: '' separator: '' empty_column: false @@ -105,13 +110,6 @@ display: separator: '
' empty_column: false responsive: '' - field_type_de_theme: - sortable: false - default_sort_order: asc - align: '' - separator: '' - empty_column: false - responsive: '' operations: align: '' separator: '' @@ -124,6 +122,27 @@ display: separator: '' empty_column: false responsive: '' + field_projet: + sortable: false + default_sort_order: asc + align: '' + separator: '' + empty_column: false + responsive: '' + field_theme: + sortable: false + default_sort_order: asc + align: '' + separator: '' + empty_column: false + responsive: '' + field_poid: + sortable: true + default_sort_order: asc + align: '' + separator: '' + empty_column: false + responsive: '' status: sortable: true default_sort_order: asc @@ -138,6 +157,13 @@ display: separator: '' empty_column: false responsive: priority-low + field_memo: + sortable: false + default_sort_order: asc + align: '' + separator: '' + empty_column: false + responsive: '' default: changed empty_table: true row: @@ -3017,3 +3043,805 @@ display: tags: - 'config:field.storage.node.field_memo' - 'config:field.storage.node.field_partenaires' + page_5: + display_options: + path: admin/content/ressources + menu: + type: tab + title: Ressources + 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: + ressource: ressource + 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 + field_memo_value: + id: field_memo_value + table: node__field_memo + field: field_memo_value + relationship: none + group_type: group + admin_label: '' + operator: contains + value: '' + group: 1 + exposed: true + expose: + operator_id: field_memo_value_op + label: memo + description: '' + use_operator: false + operator: field_memo_value_op + operator_limit_selection: false + operator_list: { } + identifier: field_memo_value + required: false + remember: false + multiple: false + remember_roles: + authenticated: authenticated + anonymous: '0' + admin: '0' + root: '0' + user: '0' + editeur: '0' + 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: string + 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_diaporama: + id: field_diaporama + table: node__field_diaporama + field: field_diaporama + relationship: none + group_type: group + admin_label: '' + label: Diaporama + 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: image + settings: + image_style: thumbnail + image_link: '' + group_column: '' + group_columns: { } + group_rows: true + delta_limit: 1 + 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 + field_projet: + id: field_projet + table: node__field_projet + field: field_projet + relationship: none + group_type: group + admin_label: '' + label: Projet + 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 + field_theme: + id: field_theme + table: node__field_theme + field: field_theme + relationship: none + group_type: group + admin_label: '' + label: Thème + 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 + field_poid: + id: field_poid + table: node__field_poid + field: field_poid + relationship: none + group_type: group + admin_label: '' + label: Poid + 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: value + type: number_integer + settings: + thousand_separator: '' + prefix_suffix: true + group_column: value + 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 + field_memo: + id: field_memo + table: node__field_memo + field: field_memo + relationship: none + group_type: group + admin_label: '' + label: memo + 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: value + type: basic_string + settings: { } + group_column: value + 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: Ressources + display_plugin: page + display_title: Ressources + id: page_5 + 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_diaporama' + - 'config:field.storage.node.field_memo' + - 'config:field.storage.node.field_poid' + - 'config:field.storage.node.field_programme' + - 'config:field.storage.node.field_projet' + - 'config:field.storage.node.field_theme' diff --git a/web/modules/custom/popsu_migrate/config/install/migrate_plus.migration.d7_node_ressource.yml b/web/modules/custom/popsu_migrate/config/install/migrate_plus.migration.d7_node_ressource.yml new file mode 100644 index 00000000..499b27ae --- /dev/null +++ b/web/modules/custom/popsu_migrate/config/install/migrate_plus.migration.d7_node_ressource.yml @@ -0,0 +1,84 @@ +id: d7_node_ressource +label: Node Ressource +migration_group: popsu +audit: true +migration_tags: + - Drupal 7 + - Content + - Popsu + +source: + plugin: d7_node_ressource + batch_size: 500 + # high_water_property: + # name: changed + # alias: n + +destination: + plugin: entity:node + +process: + # nid: nid + type: + plugin: default_value + default_value: ressource + created: created + changed: changed + + uid: + plugin: default_value + default_value: 34 + + title: title + + field_programme: + plugin: sub_process + source: field_programme + process: + target_id: + plugin: migration_lookup + migration: d7_node_programme + source: nid + no_stub: true + + field_theme: + plugin: migration_lookup + migration: d7_node_theme + source: field_theme + no_stub: true + + field_projet: + plugin: migration_lookup + migration: d7_node_projet + source: field_projet + no_stub: true + + field_poid: field_poids + + # body: body + + # field_diaporama: + # plugin: sub_process + # source: diaporama + # process: + # target_id: + # plugin: migration_lookup + # migration: d7_allpublicfiles + # source: fid + # no_stub: true + # alt: alt + # title: title + # + # field_textes: field_textes + # + # field_equipes: field_equipes + # + # field_partenaires: field_partenaires + + field_memo: field_memo + +migration_dependencies: + required: + - d7_allpublicfiles + - d7_users + - d7_taxonomy_term_type_theme diff --git a/web/modules/custom/popsu_migrate/src/Plugin/migrate/source/D7NodeRessource.php b/web/modules/custom/popsu_migrate/src/Plugin/migrate/source/D7NodeRessource.php new file mode 100644 index 00000000..7a8b166a --- /dev/null +++ b/web/modules/custom/popsu_migrate/src/Plugin/migrate/source/D7NodeRessource.php @@ -0,0 +1,259 @@ +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_publication', 'popsu_document'], '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 . ' ('.$nid.')' . '- - - - '); + + $memo = ''; + $memo .= "#migration : old nid = ".$nid."\n"; + $memo .= "#migration : old content type = ".$type."\n"; + + // 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); + // if ($field_name == 'field_poids') { + // $field_values = $field_values[0]; + // Drush::output()->writeln(dump($field_values)); + // } + } + + if ($type === "popsu_publication") { + // programme + $field_programme = $row->getSourceProperty('field_popsu_publication_popsu'); + // projet : field_popsu_publication_ville is not a theme but a ville + // theme + if ($field_theme = $row->getSourceProperty('field_popsu_publication_theme')[0]){ + // Drush::output()->writeln(dump($field_theme)); + $field_theme['target_id'] = $field_theme['nid']; + } + } else { // popsu_document + $field_popsu_doc_parent = $row->getSourceProperty('field_popsu_doc_parent'); + // get the node_type of doc_parent + $node = $this->select('node', 'n') + ->fields('n', ['nid','vid','type']) + ->condition('n.nid', $field_popsu_doc_parent[0]['nid']) + ->execute()->fetchAll()[0]; + // foreach ($this->getFields('node', $node['type']) as $field_name => $field) { + // $field_values = $this->getFieldValues('node', $field_name, $node['nid'], $node['vid'], NULL); + // $node[$field_name] = $field_values; + // } + switch ($node['type']) { + // programme + // case 'popsu_special': NO ITEM + // case 'popsu_page': NO ITEM + // projet + // case 'popsu_page_neutral': // no ref in migration + // case 'popsu_projet_europe': // merged with popsu_ville_europe + case 'popsu_ville_europe': + case 'popsu_ville': + case 'popsu_projet': + // Drush::output()->writeln(dump($node)); + $node['target_id'] = $node['nid']; + $field_projet = $node; + break; + // Theme + case 'popsu_theme_europe': + case 'popsu_theme_trans': + case 'popsu_theme_local': + $node['target_id'] = $node['nid']; + $field_theme = $node; + } + } + + if ($field_programme) { + // Drush::output()->writeln(dump($field_programme)); + $tid = $field_programme[0]['tid']; + // get the node (popsu_special) from the tid for migration_lookup + $query = $this->select('node_revision', 'nr') + ->fields('n', ['nid','type']) + ->fields('nr', ['vid']) + ->orderBy('changed'); + $query->innerJoin('node', 'n', static::JOIN); + $query->condition('n.type', 'popsu_special'); + // field_popsu_special_typetaxo + // filter to get the right special type (colloques, publication, etc) + $query->leftJoin('field_revision_field_popsu_special_typetaxo', 'ff', 'ff.revision_id = n.vid'); + $query->fields('ff', ['field_popsu_special_typetaxo_tid']); + $query->condition('ff.field_popsu_special_typetaxo_tid', 31); + // field_popsu_special_popsu + // filter to get right popsu (popsu 1, popsu europe, etc) + $query->leftJoin('field_revision_field_popsu_special_popsu', 'sp', 'sp.revision_id = n.vid'); + $query->fields('sp', ['field_popsu_special_popsu_tid']); + $query->condition('sp.field_popsu_special_popsu_tid', $tid); + + $prog = $query->execute()->fetchAll(); + + $row->setSourceProperty('field_programme', array(array('nid'=>$prog[0]['nid']))); + } + + if (!empty($field_projet)) { + // Drush::output()->writeln(dump($field_projet)); + $row->setSourceProperty('field_projet', $field_projet); + } + + if (!empty($field_theme)) { + // Drush::output()->writeln(dump($field_theme)); + $row->setSourceProperty('field_theme', $field_theme); + } + + // // Body + // if ($field_body) { + // $field_body[0]['format'] = 'wysiwyg'; + // $row->setSourceProperty('body', $field_body); + // } + + // record migration errors in field_memo + if(isset($memo)){ + $field_memo = array( + array( + 'value' => $memo + ) + ); + $row->setSourceProperty('field_memo', $field_memo); + } + + 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; + } + +}