Pārlūkot izejas kodu

popsu_migrate: D7NodeTheme images ok

bach 3 gadi atpakaļ
vecāks
revīzija
29917075fd

+ 3 - 3
config/sync/field.field.node.theme.field_image.yml

@@ -23,9 +23,9 @@ settings:
   max_filesize: ''
   max_resolution: ''
   min_resolution: ''
-  alt_field: false
-  alt_field_required: true
-  title_field: false
+  alt_field: true
+  alt_field_required: false
+  title_field: true
   title_field_required: false
   default_image:
     uuid: ''

+ 1 - 1
config/sync/migrate_plus.migration.d7_allpublicfiles.yml

@@ -1,4 +1,4 @@
-uuid: fbacd6fb-fb76-401a-bfdb-e217cad3c0a7
+uuid: 109c9789-49c4-496b-9752-dbef07f4844f
 langcode: fr
 status: true
 dependencies: {  }

+ 1 - 1
config/sync/migrate_plus.migration.d7_node_programme.yml

@@ -1,4 +1,4 @@
-uuid: e946434c-cbc1-430a-ae3e-c2a79cd3ee93
+uuid: 4f12194e-d946-4dac-951d-473619e7e1fa
 langcode: fr
 status: true
 dependencies: {  }

+ 13 - 2
config/sync/migrate_plus.migration.d7_node_theme.yml

@@ -1,9 +1,9 @@
-uuid: 6c24ccb0-9a42-4162-9900-4fe6edde5825
+uuid: 33fb807a-7941-481f-85c6-745336b34fde
 langcode: fr
 status: true
 dependencies: {  }
 _core:
-  default_config_hash: v7lZxj69QSpfsfR5KJSQSV4wPE42ubLZxMh_i2bU8NI
+  default_config_hash: rJxQh2W7x4hn1fMvgAiyjsdjG3SPO8Re_q5Zv15hgcQ
 id: d7_node_theme
 class: null
 field_plugin_method: null
@@ -35,6 +35,17 @@ process:
     migration: d7_node_programme
     source: programme
     no_stub: true
+  field_image:
+    plugin: sub_process
+    source: images
+    process:
+      target_id:
+        plugin: migration_lookup
+        migration: d7_allpublicfiles
+        source: fid
+        no_stub: true
+      alt: alt
+      title: title
 destination:
   plugin: 'entity:node'
 migration_dependencies:

+ 1 - 1
config/sync/migrate_plus.migration.d7_users.yml

@@ -1,4 +1,4 @@
-uuid: 438c8942-0614-45aa-8a96-365289e597d6
+uuid: f4fce287-cf41-4cbd-bc42-d38df4c92f24
 langcode: fr
 status: true
 dependencies: {  }

+ 1 - 1
config/sync/migrate_plus.migration_group.popsu.yml

@@ -1,4 +1,4 @@
-uuid: b4b6ad27-bd70-4b30-9972-563b5c68e683
+uuid: 734983b5-c217-433d-ac9c-6c923c681360
 langcode: fr
 status: true
 dependencies:

+ 68 - 0
config/sync/views.view.content.yml

@@ -3,10 +3,13 @@ langcode: fr
 status: true
 dependencies:
   config:
+    - field.storage.node.field_image
     - field.storage.node.field_programme
+    - image.style.thumbnail
     - node.type.programme
     - node.type.theme
   module:
+    - image
     - node
     - user
 _core:
@@ -930,6 +933,70 @@ display:
           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
@@ -1122,4 +1189,5 @@ display:
         - user.permissions
       max-age: 0
       tags:
+        - 'config:field.storage.node.field_image'
         - 'config:field.storage.node.field_programme'

+ 12 - 0
web/modules/custom/popsu_migrate/config/install/migrate_plus.migration.d7_node_theme.yml

@@ -38,6 +38,18 @@ process:
     source: programme
     no_stub: true
 
+  field_image:
+    plugin: sub_process
+    source: images
+    process:
+      target_id:
+        plugin: migration_lookup
+        migration: d7_allpublicfiles
+        source: fid
+        no_stub: true
+      alt: alt
+      title: title
+
 migration_dependencies:
   required:
     - d7_allpublicfiles

+ 13 - 2
web/modules/custom/popsu_migrate/src/Plugin/migrate/source/D7NodeTheme.php

@@ -125,11 +125,17 @@ class D7NodeTheme extends FieldableEntity {
         case 'field_popsu_themeur_popsu':
           $field_programme = $field_values;
           break;
+        case 'field_popsu_themloc_imageintro':
+          $field_images = $field_values;
+          break;
+        case 'field_popsu_themtrans_imag_illus':
+          $field_images = $field_values;
+          break;
       }
     }
 
     if ($field_programme) {
-      Drush::output()->writeln(dump($field_programme));
+      // Drush::output()->writeln(dump($field_programme));
       // get the nid of popsu_special from the tid of popsu for migration lookup
       // Select node in its last revision.
       $query = $this->select('node_revision', 'nr')
@@ -149,11 +155,16 @@ class D7NodeTheme extends FieldableEntity {
       $query->condition('sp.field_popsu_special_popsu_tid', $field_programme[0]['tid']);
 
       $prog = $query->execute()->fetchAll();
-      Drush::output()->writeln(dump($prog));
+      // Drush::output()->writeln(dump($prog));
 
       $row->setSourceProperty('programme', $prog[0]['nid']);
     }
 
+    if ($field_images) {
+      Drush::output()->writeln(dump($field_images));
+      $row->setSourceProperty('images', $field_images);
+    }
+
     return parent::prepareRow($row);
   }