Quellcode durchsuchen

popsu_migrate: Created D7NodeProjet, D7NodeTheme themes et projets liés ok

bach vor 3 Jahren
Ursprung
Commit
14b6df455a

+ 1 - 0
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

+ 3 - 1
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

+ 1 - 1
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: {  }

+ 1 - 1
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: {  }

+ 39 - 0
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

+ 13 - 2
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:

+ 1 - 1
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: {  }

+ 1 - 1
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: {  }

+ 1 - 1
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:

+ 572 - 0
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'

+ 45 - 0
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

+ 14 - 0
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

+ 160 - 0
web/modules/custom/popsu_migrate/src/Plugin/migrate/source/D7NodeProjet.php

@@ -0,0 +1,160 @@
+<?php
+namespace Drupal\popsu_migrate\Plugin\migrate\source;
+
+use Drupal\Core\Extension\ModuleHandlerInterface;
+use Drupal\migrate\Row;
+use Drupal\migrate_drupal\Plugin\migrate\source\d7\FieldableEntity;
+use Drupal\Core\Database\Query\SelectInterface;
+use Drupal\Core\Entity\EntityTypeManagerInterface;
+use Drupal\Core\Extension\ModuleHandler;
+use Drupal\Core\State\StateInterface;
+use Drupal\migrate\Plugin\MigrationInterface;
+use Symfony\Component\DependencyInjection\ContainerInterface;
+use Drupal\Core\Logger\LoggerChannelFactoryInterface;
+use Drush\Drush;
+
+// use Drupal\popsu_migrate\Plugin\migrate\source\D7Programme;
+
+/**
+ * Drupal 7 node source from database.
+ *
+ * @MigrateSource(
+ *   id = "d7_node_projet",
+ *   source_module = "node"
+ * )
+ */
+class D7NodeProjet extends FieldableEntity {
+  /**
+   * The module handler.
+   *
+   * @var \Drupal\Core\Extension\ModuleHandlerInterface
+   */
+  protected $moduleHandler;
+
+  /**
+   * The logger channel.
+   *
+   * @var \Drupal\Core\Logger\LoggerChannelInterface
+   */
+  protected $logger;
+
+
+  /**
+   * {@inheritdoc}
+   */
+  public function __construct(array $configuration, $plugin_id, $plugin_definition, MigrationInterface $migration, StateInterface $state, EntityTypeManagerInterface $entity_manager, ModuleHandlerInterface $module_handler,LoggerChannelFactoryInterface $loggerFactory) {
+    parent::__construct($configuration, $plugin_id, $plugin_definition, $migration, $state, $entity_manager);
+    $this->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;
+  }
+
+}

+ 21 - 0
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);
   }