From 2d890bae995290d1e064d40d6e80f921257ace7e Mon Sep 17 00:00:00 2001 From: bach Date: Mon, 19 Apr 2021 22:59:33 +0200 Subject: [PATCH] popsu_migrate: D7TaxoTermVille ok, D7NodeProjet links, ville, programme ok, memo --- ...ntity_form_display.node.projet.default.yml | 9 + ...ntity_view_display.node.projet.default.yml | 8 + ...entity_view_display.node.projet.teaser.yml | 2 + .../field.field.node.projet.field_memo.yml | 19 + config/sync/field.storage.node.field_memo.yml | 19 + ...grate_plus.migration.d7_allpublicfiles.yml | 2 +- ...grate_plus.migration.d7_node_programme.yml | 2 +- .../migrate_plus.migration.d7_node_projet.yml | 46 +- .../migrate_plus.migration.d7_node_theme.yml | 2 +- ....migration.d7_taxonomy_term_type_theme.yml | 2 +- ..._plus.migration.d7_taxonomy_term_ville.yml | 31 + .../sync/migrate_plus.migration.d7_users.yml | 2 +- .../migrate_plus.migration_group.popsu.yml | 2 +- config/sync/views.view.admin_taxo.yml | 535 ++++++++++++++++++ config/sync/views.view.content.yml | 424 ++++++++++++++ .../migrate_plus.migration.d7_node_projet.yml | 56 +- ..._plus.migration.d7_taxonomy_term_ville.yml | 29 + .../Plugin/migrate/source/D7NodeProjet.php | 141 ++++- .../Plugin/migrate/source/D7TaxotermVille.php | 87 +++ 19 files changed, 1393 insertions(+), 25 deletions(-) create mode 100644 config/sync/field.field.node.projet.field_memo.yml create mode 100644 config/sync/field.storage.node.field_memo.yml create mode 100644 config/sync/migrate_plus.migration.d7_taxonomy_term_ville.yml create mode 100644 config/sync/views.view.admin_taxo.yml create mode 100644 web/modules/custom/popsu_migrate/config/install/migrate_plus.migration.d7_taxonomy_term_ville.yml create mode 100644 web/modules/custom/popsu_migrate/src/Plugin/migrate/source/D7TaxotermVille.php diff --git a/config/sync/core.entity_form_display.node.projet.default.yml b/config/sync/core.entity_form_display.node.projet.default.yml index e4b4151f..44afd82f 100644 --- a/config/sync/core.entity_form_display.node.projet.default.yml +++ b/config/sync/core.entity_form_display.node.projet.default.yml @@ -8,6 +8,7 @@ dependencies: - field.field.node.projet.field_diaporama - field.field.node.projet.field_equipes - field.field.node.projet.field_evenements_lies + - field.field.node.projet.field_memo - field.field.node.projet.field_partenaires - field.field.node.projet.field_programme - field.field.node.projet.field_projets_lies @@ -201,6 +202,14 @@ content: third_party_settings: { } type: entity_reference_autocomplete region: content + field_memo: + weight: 27 + settings: + rows: 5 + placeholder: '' + third_party_settings: { } + type: string_textarea + region: content field_partenaires: type: inline_entity_form_simple weight: 5 diff --git a/config/sync/core.entity_view_display.node.projet.default.yml b/config/sync/core.entity_view_display.node.projet.default.yml index 2e589066..a7160019 100644 --- a/config/sync/core.entity_view_display.node.projet.default.yml +++ b/config/sync/core.entity_view_display.node.projet.default.yml @@ -8,6 +8,7 @@ dependencies: - field.field.node.projet.field_diaporama - field.field.node.projet.field_equipes - field.field.node.projet.field_evenements_lies + - field.field.node.projet.field_memo - field.field.node.projet.field_partenaires - field.field.node.projet.field_programme - field.field.node.projet.field_projets_lies @@ -67,6 +68,13 @@ content: third_party_settings: { } type: entity_reference_label region: content + field_memo: + weight: 114 + label: above + settings: { } + third_party_settings: { } + type: basic_string + region: content field_partenaires: type: entity_reference_revisions_entity_view weight: 112 diff --git a/config/sync/core.entity_view_display.node.projet.teaser.yml b/config/sync/core.entity_view_display.node.projet.teaser.yml index ef043081..5c89307e 100644 --- a/config/sync/core.entity_view_display.node.projet.teaser.yml +++ b/config/sync/core.entity_view_display.node.projet.teaser.yml @@ -9,6 +9,7 @@ dependencies: - field.field.node.projet.field_diaporama - field.field.node.projet.field_equipes - field.field.node.projet.field_evenements_lies + - field.field.node.projet.field_memo - field.field.node.projet.field_partenaires - field.field.node.projet.field_programme - field.field.node.projet.field_projets_lies @@ -43,6 +44,7 @@ hidden: field_diaporama: true field_equipes: true field_evenements_lies: true + field_memo: true field_partenaires: true field_programme: true field_projets_lies: true diff --git a/config/sync/field.field.node.projet.field_memo.yml b/config/sync/field.field.node.projet.field_memo.yml new file mode 100644 index 00000000..5f15bde6 --- /dev/null +++ b/config/sync/field.field.node.projet.field_memo.yml @@ -0,0 +1,19 @@ +uuid: 97b36d26-7cd6-4b41-892b-0a799607ab3a +langcode: fr +status: true +dependencies: + config: + - field.storage.node.field_memo + - node.type.projet +id: node.projet.field_memo +field_name: field_memo +entity_type: node +bundle: projet +label: memo +description: '' +required: false +translatable: false +default_value: { } +default_value_callback: '' +settings: { } +field_type: string_long diff --git a/config/sync/field.storage.node.field_memo.yml b/config/sync/field.storage.node.field_memo.yml new file mode 100644 index 00000000..7cff1e07 --- /dev/null +++ b/config/sync/field.storage.node.field_memo.yml @@ -0,0 +1,19 @@ +uuid: e0356f2e-865f-4e67-81ef-d861a9b6ee38 +langcode: fr +status: true +dependencies: + module: + - node +id: node.field_memo +field_name: field_memo +entity_type: node +type: string_long +settings: + case_sensitive: false +module: core +locked: false +cardinality: 1 +translatable: true +indexes: { } +persist_with_no_fields: false +custom_storage: false diff --git a/config/sync/migrate_plus.migration.d7_allpublicfiles.yml b/config/sync/migrate_plus.migration.d7_allpublicfiles.yml index 3c2a79e0..18fc0010 100644 --- a/config/sync/migrate_plus.migration.d7_allpublicfiles.yml +++ b/config/sync/migrate_plus.migration.d7_allpublicfiles.yml @@ -1,4 +1,4 @@ -uuid: f77d5481-ece0-47fe-b046-b69ab3876303 +uuid: 68572ca4-7034-4619-93fb-7746d5444c87 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 18a3a0c3..eacd9742 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: 05dac26f-a442-447f-b553-d3157114c7a6 +uuid: 87cdeb88-a1c1-4b93-a825-af4ac6e1a64c 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 ed480528..761438a7 100644 --- a/config/sync/migrate_plus.migration.d7_node_projet.yml +++ b/config/sync/migrate_plus.migration.d7_node_projet.yml @@ -1,9 +1,9 @@ -uuid: cf67cd9d-0073-41be-95bf-7c0c2daeedd0 +uuid: 7bc4232f-4cf7-47b8-a18f-55cb75054a79 langcode: fr status: true dependencies: { } _core: - default_config_hash: 1F9ybTf9deXW-90QNi5lAFvj5IWLs7DuiZ5npJvkx68 + default_config_hash: 2YwRSmCFiJrKbOiF_Y33rBPNxqM9llOfJdc67FOg-lU id: d7_node_projet class: null field_plugin_method: null @@ -17,9 +17,6 @@ label: 'Node Projet' source: plugin: d7_node_projet batch_size: 500 - high_water_property: - name: changed - alias: 'n' process: type: plugin: default_value @@ -30,6 +27,45 @@ process: plugin: default_value default_value: 34 title: title + field_ville: + plugin: migration_lookup + migration: d7_taxonomy_term_ville + source: ville + no_stub: true + field_programme: + plugin: sub_process + source: field_programme + process: + target_id: + plugin: migration_lookup + migration: d7_node_programme + source: nid + no_stub: true + field_comparatifs_associes: + plugin: sub_process + source: field_comparatifs_associes + process: + target_id: + plugin: migration_lookup + migration: d7_node_theme + source: nid + field_themes_lies: + plugin: sub_process + source: field_themes_lies + process: + target_id: + plugin: migration_lookup + migration: d7_node_theme + source: nid + field_projets_lies: + plugin: sub_process + source: field_projets_lies + process: + target_id: + plugin: migration_lookup + migration: d7_node_projet + source: nid + field_memo: field_memo destination: plugin: 'entity:node' migration_dependencies: diff --git a/config/sync/migrate_plus.migration.d7_node_theme.yml b/config/sync/migrate_plus.migration.d7_node_theme.yml index cf852e22..39aa1464 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: 621d7d2c-29c4-45e0-9896-816803c63290 +uuid: 76257738-6915-4128-95f7-933ff4889c8d 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 c8119cde..04aa5f34 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: 9b980c5a-4b23-4473-a165-15622e2a915e +uuid: 7ab17bc8-b6e0-4687-932b-1648ef18b94d 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 new file mode 100644 index 00000000..1406b941 --- /dev/null +++ b/config/sync/migrate_plus.migration.d7_taxonomy_term_ville.yml @@ -0,0 +1,31 @@ +uuid: 2e8300b7-a2a1-44da-81f7-935c84c24a13 +langcode: fr +status: true +dependencies: { } +_core: + default_config_hash: AIo0rBvn1SeEsRPJ_R1KmTG4Rm7rDPpPQCqU6gLUmTA +id: d7_taxonomy_term_ville +class: null +field_plugin_method: null +cck_plugin_method: null +migration_tags: + - 'Drupal 7' + - Content + - Popsu +migration_group: popsu +label: 'Taxonomy terms Villes' +source: + plugin: d7_taxoterm_ville + bundle: popsu_villes +process: + vid: + plugin: default_value + default_value: villes + name: name + description/value: description + description/format: format + weight: weight + changed: timestamp +destination: + plugin: 'entity:taxonomy_term' +migration_dependencies: null diff --git a/config/sync/migrate_plus.migration.d7_users.yml b/config/sync/migrate_plus.migration.d7_users.yml index ee0b719b..bb525928 100644 --- a/config/sync/migrate_plus.migration.d7_users.yml +++ b/config/sync/migrate_plus.migration.d7_users.yml @@ -1,4 +1,4 @@ -uuid: f0f36010-9331-4eb1-8d7c-fb9d73725774 +uuid: b4840ade-bdc4-49ac-a1ac-8b34e1c72222 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 59ddecc5..1cc71561 100644 --- a/config/sync/migrate_plus.migration_group.popsu.yml +++ b/config/sync/migrate_plus.migration_group.popsu.yml @@ -1,4 +1,4 @@ -uuid: 1c7ff499-a3e4-4009-950e-3e2a45c7b814 +uuid: 6b775d9f-8a38-42ac-9fa0-1502ebc69527 langcode: fr status: true dependencies: diff --git a/config/sync/views.view.admin_taxo.yml b/config/sync/views.view.admin_taxo.yml new file mode 100644 index 00000000..0b88496b --- /dev/null +++ b/config/sync/views.view.admin_taxo.yml @@ -0,0 +1,535 @@ +uuid: 1de4cf6d-aa59-4547-a8de-c5808c53d4e7 +langcode: fr +status: true +dependencies: + config: + - taxonomy.vocabulary.villes + module: + - taxonomy + - text + - user + - views_bulk_operations +id: admin_taxo +label: 'admin taxo' +module: views +description: '' +tag: '' +base_table: taxonomy_term_field_data +base_field: tid +display: + default: + display_plugin: default + id: default + display_title: Master + position: 0 + display_options: + access: + type: perm + options: + perm: 'access content overview' + cache: + type: tag + options: { } + query: + type: views_query + options: + disable_sql_rewrite: false + distinct: false + replica: false + query_comment: '' + query_tags: { } + exposed_form: + type: basic + options: + submit_button: Appliquer + reset_button: false + reset_button_label: Réinitialiser + exposed_sorts_label: 'Trier par' + expose_sort_order: true + sort_asc_label: Asc + sort_desc_label: Desc + pager: + type: mini + options: + items_per_page: 10 + offset: 0 + id: 0 + total_pages: null + expose: + items_per_page: false + items_per_page_label: 'Éléments par page' + items_per_page_options: '5, 10, 25, 50' + items_per_page_options_all: false + items_per_page_options_all_label: '- Tout -' + offset: false + offset_label: Décalage + tags: + previous: ‹‹ + next: ›› + style: + type: table + options: + grouping: { } + row_class: '' + default_row_class: true + override: true + sticky: false + caption: '' + summary: '' + description: '' + columns: + views_bulk_operations_bulk_form: views_bulk_operations_bulk_form + name: name + operations: name + description__value: description__value + changed: changed + info: + views_bulk_operations_bulk_form: + align: '' + separator: '' + empty_column: false + responsive: '' + name: + sortable: true + default_sort_order: asc + align: '' + separator: '
' + empty_column: false + responsive: '' + operations: + align: '' + separator: '' + empty_column: false + responsive: '' + description__value: + sortable: false + default_sort_order: asc + align: '' + separator: '' + empty_column: false + responsive: '' + changed: + sortable: true + default_sort_order: asc + align: '' + separator: '' + empty_column: false + responsive: '' + default: '-1' + empty_table: false + row: + type: fields + options: + inline: { } + separator: '' + hide_empty: false + default_field_elements: true + fields: + views_bulk_operations_bulk_form: + id: views_bulk_operations_bulk_form + table: views + field: views_bulk_operations_bulk_form + relationship: none + group_type: group + admin_label: '' + label: '' + 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 + batch: true + batch_size: 10 + form_step: true + buttons: false + clear_on_exposed: true + action_title: Action + selected_actions: + 0: + action_id: 'entity:break_lock:taxonomy_term' + preconfiguration: + add_confirmation: 0 + 3: + action_id: 'entity:publish_action:taxonomy_term' + preconfiguration: + add_confirmation: 0 + 5: + action_id: 'entity:unpublish_action:taxonomy_term' + preconfiguration: + add_confirmation: 0 + force_selection_info: 0 + plugin_id: views_bulk_operations_bulk_form + name: + id: name + table: taxonomy_term_field_data + field: name + entity_type: taxonomy_term + entity_field: name + label: '' + alter: + alter_text: false + make_link: false + absolute: false + trim: false + word_boundary: false + ellipsis: false + strip_tags: false + html: false + hide_empty: false + empty_zero: false + type: string + settings: + link_to_entity: true + plugin_id: term_name + relationship: none + group_type: group + admin_label: '' + exclude: 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_alter_empty: true + click_sort_column: value + 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 + convert_spaces: false + operations: + id: operations + table: taxonomy_term_data + field: operations + relationship: none + group_type: group + admin_label: '' + label: 'Liens d''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: false + entity_type: taxonomy_term + plugin_id: entity_operations + description__value: + id: description__value + table: taxonomy_term_field_revision + field: description__value + relationship: none + group_type: group + admin_label: '' + label: Description + 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: text_default + 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 + entity_type: taxonomy_term + entity_field: description + plugin_id: field + changed: + id: changed + table: taxonomy_term_field_revision + field: changed + relationship: none + group_type: group + admin_label: '' + label: Modifié + 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: timestamp + settings: + date_format: medium + custom_date_format: '' + timezone: '' + 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 + entity_type: taxonomy_term + entity_field: changed + plugin_id: field + filters: + status: + value: '1' + table: taxonomy_term_field_data + field: status + plugin_id: boolean + entity_type: taxonomy_term + entity_field: status + id: status + expose: + operator: '' + operator_limit_selection: false + operator_list: { } + group: 1 + vid: + id: vid + table: taxonomy_term_field_data + field: vid + relationship: none + group_type: group + admin_label: '' + operator: in + value: + villes: villes + group: 1 + exposed: false + expose: + operator_id: '' + label: '' + description: '' + use_operator: false + operator: '' + operator_limit_selection: false + operator_list: { } + identifier: '' + required: false + remember: false + multiple: false + remember_roles: + authenticated: authenticated + 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: { } + entity_type: taxonomy_term + entity_field: vid + plugin_id: bundle + sorts: { } + header: + result: + id: result + table: views + field: result + relationship: none + group_type: group + admin_label: '' + empty: false + content: 'Affichage de @start à @end sur @total' + plugin_id: result + footer: { } + empty: { } + relationships: { } + arguments: { } + display_extenders: { } + title: Villes + cache_metadata: + max-age: 0 + contexts: + - 'languages:language_content' + - 'languages:language_interface' + - url.query_args + - user.permissions + tags: { } + page_1: + display_plugin: page + id: page_1 + display_title: Villes + position: 1 + display_options: + display_extenders: + views_ef_fieldset: { } + display_description: '' + path: admin/content/villes + menu: + type: tab + title: Villes + description: '' + expanded: false + parent: system.admin_content + weight: 0 + context: '0' + menu_name: admin + cache_metadata: + max-age: 0 + contexts: + - 'languages:language_content' + - 'languages:language_interface' + - url.query_args + - user.permissions + tags: { } diff --git a/config/sync/views.view.content.yml b/config/sync/views.view.content.yml index a6be4c92..7e1bdc8d 100644 --- a/config/sync/views.view.content.yml +++ b/config/sync/views.view.content.yml @@ -3,15 +3,20 @@ langcode: fr status: true dependencies: config: + - field.storage.node.field_comparatifs_associes - field.storage.node.field_image + - field.storage.node.field_memo - field.storage.node.field_programme + - field.storage.node.field_projets_lies - 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.theme - taxonomy.vocabulary.types_de_theme + - taxonomy.vocabulary.villes module: - image - node @@ -1617,6 +1622,106 @@ display: default_group_multiple: { } group_items: { } plugin_id: numeric + field_ville_target_id: + id: field_ville_target_id + table: node__field_ville + field: field_ville_target_id + relationship: none + group_type: group + admin_label: '' + operator: or + value: { } + group: 1 + exposed: true + expose: + operator_id: field_ville_target_id_op + label: Ville + description: '' + use_operator: false + operator: field_ville_target_id_op + operator_limit_selection: false + operator_list: { } + identifier: field_ville_target_id + required: false + remember: false + multiple: false + remember_roles: + authenticated: authenticated + anonymous: '0' + admin: '0' + root: '0' + user: '0' + editeur: '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: { } + reduce_duplicates: false + type: textfield + limit: true + vid: villes + hierarchy: false + error_message: true + parent: 0 + level_labels: '' + force_deepest: false + save_lineage: false + hierarchy_depth: 0 + required_depth: 0 + plugin_id: taxonomy_index_tid + 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 @@ -1840,6 +1945,258 @@ display: separator: ', ' field_api_classes: false plugin_id: field + field_ville: + id: field_ville + table: node__field_ville + field: field_ville + relationship: none + group_type: group + admin_label: '' + label: Ville + 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_projets_lies: + id: field_projets_lies + table: node__field_projets_lies + field: field_projets_lies + relationship: none + group_type: group + admin_label: '' + label: 'Projets 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: ul + 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: ul + separator: ', ' + field_api_classes: false + plugin_id: field + field_comparatifs_associes: + id: field_comparatifs_associes + table: node__field_comparatifs_associes + field: field_comparatifs_associes + relationship: none + group_type: group + admin_label: '' + label: 'Comparatifs associé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: ul + separator: ', ' + field_api_classes: false + plugin_id: field status: id: status table: node_field_data @@ -1884,6 +2241,68 @@ display: 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: Projets display_plugin: page display_title: Projets @@ -1900,5 +2319,10 @@ display: - user.permissions max-age: 0 tags: + - 'config:field.storage.node.field_comparatifs_associes' - 'config:field.storage.node.field_image' + - 'config:field.storage.node.field_memo' - 'config:field.storage.node.field_programme' + - 'config:field.storage.node.field_projets_lies' + - 'config:field.storage.node.field_themes_lies' + - 'config:field.storage.node.field_ville' 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 index 51b5c7fd..ef0f4810 100644 --- 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 @@ -10,9 +10,9 @@ migration_tags: source: plugin: d7_node_projet batch_size: 500 - high_water_property: - name: changed - alias: n + # high_water_property: + # name: changed + # alias: n destination: plugin: entity:node @@ -31,11 +31,51 @@ process: title: title - # field_programme: - # plugin: migration_lookup - # migration: d7_node_programme - # source: programme - # no_stub: true + field_ville: + plugin: migration_lookup + migration: d7_taxonomy_term_ville + source: ville + no_stub: true + + + field_programme: + plugin: sub_process + source: field_programme + process: + target_id: + plugin: migration_lookup + migration: d7_node_programme + source: nid + no_stub: true + + field_comparatifs_associes: + plugin: sub_process + source: field_comparatifs_associes + process: + target_id: + plugin: migration_lookup + migration: d7_node_theme + source: nid + + field_themes_lies: + plugin: sub_process + source: field_themes_lies + process: + target_id: + plugin: migration_lookup + migration: d7_node_theme + source: nid + + field_projets_lies: + plugin: sub_process + source: field_projets_lies + process: + target_id: + plugin: migration_lookup + migration: d7_node_projet + source: nid + + field_memo: field_memo migration_dependencies: diff --git a/web/modules/custom/popsu_migrate/config/install/migrate_plus.migration.d7_taxonomy_term_ville.yml b/web/modules/custom/popsu_migrate/config/install/migrate_plus.migration.d7_taxonomy_term_ville.yml new file mode 100644 index 00000000..ed9dfda8 --- /dev/null +++ b/web/modules/custom/popsu_migrate/config/install/migrate_plus.migration.d7_taxonomy_term_ville.yml @@ -0,0 +1,29 @@ +id: d7_taxonomy_term_ville +label: Taxonomy terms Villes +migration_group: popsu +audit: true +migration_tags: + - Drupal 7 + - Content + - Popsu +deriver: Drupal\taxonomy\Plugin\migrate\D7TaxonomyTermDeriver + +source: + plugin: d7_taxoterm_ville + bundle: popsu_villes + +destination: + plugin: entity:taxonomy_term + +process: + # If you are using this file to build a custom migration consider removing + # the tid field to allow incremental migrations. + # tid: tid + vid: + plugin: default_value + default_value: villes + name: name + 'description/value': description + 'description/format': format + weight: weight + changed: timestamp 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 index 35f5052c..451da8ee 100644 --- a/web/modules/custom/popsu_migrate/src/Plugin/migrate/source/D7NodeProjet.php +++ b/web/modules/custom/popsu_migrate/src/Plugin/migrate/source/D7NodeProjet.php @@ -109,17 +109,146 @@ class D7NodeProjet extends FieldableEntity { $vid = $row->getSourceProperty('vid'); $type = $row->getSourceProperty('type'); $title = $row->getSourceProperty('title'); - Drush::output()->writeln('- - - - ' . $title . '- - - - '); + Drush::output()->writeln('- - - - ' . $title . ' ('.$nid.')' . '- - - - '); + + $memo = ''; + $memo .= "#migration : old nid = ".$nid."\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); - // switch ($field_name) { - // case 'field_popsu_themloc_popsu': - // $field_programme = $field_values; - // break; - // } + switch ($field_name) { + // ville + case 'field_popsu_ville_ville': + $ville = $field_values; + break; + case 'field_popsu_villeur_ville': + $ville = $field_values; + break; + case 'field_popsu_projet_ville': + $ville = $field_values; + break; + // programme + case 'field_popsu_ville_popsu': + $field_programme = $field_values; + break; + case 'field_popsu_villeur_popsu': + $field_programme = $field_values; + break; + case 'field_popsu_projet_popsu': + $field_programme = $field_values; + break; + } + } + 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']))); + } else { + Drush::output()->writeln('NO PROGRAMME'); + $memo .= "#migration : NO PROGRAMME\n"; + } + + if ($field_popsu_projet_comparatif = $row->getSourceProperty('field_popsu_projet_comparatif')) { + // Drush::output()->writeln(dump($field_comparatifs_associes)); + $row->setSourceProperty('field_comparatifs_associes', $field_popsu_projet_comparatif); + } + + $field_themes_lies = array(); + $field_projets_lies = array(); + if ($field_popsu_projet_lies = $row->getSourceProperty('field_popsu_projet_lies')) { + // Drush::output()->writeln(dump($field_popsu_projet_lies)); + foreach ($field_popsu_projet_lies as $key => $value) { + // check if theme + $q = $this->select('node', 'n') + ->fields('n', ['nid','type']) + ->condition('n.nid', $value['nid']) + ->condition('n.type', ['popsu_theme_local', 'popsu_projet'], 'IN'); + $res = $q->execute()->fetchAll(); + if (!empty($res)) { + // Drush::output()->writeln(dump($res)); + switch ($res[0]['type']) { + case 'popsu_theme_local': + $field_themes_lies[] = $value; + break; + case 'popsu_projet': + $field_projets_lies[] = $value; + break; + } + } + } + } + + if (!empty($field_projets_lies)) { + // Drush::output()->writeln(dump($field_themes_lies)); + $row->setSourceProperty('field_projets_lies', $field_projets_lies); + } + + // get the popsu_projet_europe nodes for popsu_ville_europe + // we need themes and imags + if ($type === 'popsu_ville_europe') { + $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_projet_europe'); + // field_popsu_projeteur_ville + // filter to get the right node + $query->leftJoin('field_data_field_popsu_projeteur_ville', 'v', 'v.revision_id = n.vid'); + $query->fields('v', ['field_popsu_projeteur_ville_tid']); + $query->condition('v.field_popsu_projeteur_ville_tid', $ville[0]['tid']); + $popsu_projet_europe = $query->execute()->fetchAll(); + + foreach ($popsu_projet_europe as $key => $value) { + // Get Field API field values. + foreach ($this->getFields('node', 'popsu_projet_europe') as $field_name => $field) { + $popsu_projet_europe[$key][$field_name] = $this->getFieldValues('node', $field_name, $value['nid'], $value['vid'], NULL); + } + // get the themes + if (!empty($popsu_projet_europe[$key]['field_popsu_projeteur_theme'])) { + foreach ($popsu_projet_europe[$key]['field_popsu_projeteur_theme'] as $theme) { + $field_themes_lies[] = $theme; + } + } + // TODO: get the images + } + // Drush::output()->writeln(dump($popsu_projet_europe)); + } + if (!empty($field_themes_lies)) { + // Drush::output()->writeln(dump($field_themes_lies)); + $row->setSourceProperty('field_themes_lies', $field_themes_lies); + } + + // 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); diff --git a/web/modules/custom/popsu_migrate/src/Plugin/migrate/source/D7TaxotermVille.php b/web/modules/custom/popsu_migrate/src/Plugin/migrate/source/D7TaxotermVille.php new file mode 100644 index 00000000..2554c203 --- /dev/null +++ b/web/modules/custom/popsu_migrate/src/Plugin/migrate/source/D7TaxotermVille.php @@ -0,0 +1,87 @@ +select('taxonomy_term_data', 'td') + ->fields('td') + ->orderBy('tid'); + + $query->leftJoin('taxonomy_vocabulary', 'tv', 'td.vid = tv.vid'); + $query->addField('tv', 'machine_name'); + + if (isset($this->configuration['bundle'])) { + $query->condition('tv.machine_name', (array) $this->configuration['bundle'], 'IN'); + } + + return $query; + } + + /** + * {@inheritdoc} + */ + public function fields() { + $fields = [ + 'tid' => $this->t('The term ID.'), + 'vid' => $this->t('Existing term VID'), + 'machine_name' => $this->t('Vocabulary machine name'), + 'name' => $this->t('The name of the term.'), + 'description' => $this->t('The term description.'), + 'weight' => $this->t('Weight'), + 'parent' => $this->t("The Drupal term IDs of the term's parents."), + 'format' => $this->t("Format of the term description."), + 'synonyms' => $this->t("Term's Synonyms (field : synonyms_synonym)"), + 'displayed_on_advanced_search' => $this->t("field_used_on_advanced_search"), + 'revision_id' => $this->t('Revision ID'), + 'language' => $this->t('Term translation language'), + 'source' => $this->t('Term translation source language'), + ]; + return $fields; + } + + + /** + * {@inheritdoc} + */ + public function prepareRow(Row $row) { + $language = $row->getSourceProperty('language'); + // drush_print('-- '.$language."\t".$row->getSourceProperty('tid')."\t".$row->getSourceProperty('name')); + + $tid = $row->getSourceProperty('tid'); + // vocabulary machine name + $machine_name = $row->getSourceProperty('machine_name'); + $revid = $row->getSourceProperty('revision_id'); + + // Get Field API field values. + foreach ($this->getFields('taxonomy_term', $machine_name) as $field_name => $field) { + $row->setSourceProperty($field_name, $this->getFieldValues('taxonomy_term', $field_name, $tid, $revid, NULL)); + } + + return parent::prepareRow($row); + } + + /** + * {@inheritdoc} + */ + public function getIds() { + $ids['tid']['type'] = 'integer'; + return $ids; + } + +}