Browse Source

fixed article migration : body & field_source

Bachir Soussi Chiadmi 5 years ago
parent
commit
235ed1d32f

+ 10 - 3
config/sync/migrate_plus.migration.d7_node_article.yml

@@ -1,9 +1,9 @@
-uuid: ecec57d1-7cb8-4634-8508-05caa0e364ca
+uuid: 62c0cbbe-058f-4cfb-83dc-33ddd12c54a8
 langcode: en
 status: true
 dependencies: {  }
 _core:
-  default_config_hash: p0mdscuBIXXF0FIhjY9CCji-FhamTKx6LUlnwTkLzMY
+  default_config_hash: EMJZXjJ_nG0xuawQaOH-p_ORBAYmBTmygs_QRgD3qJ4
 id: d7_node_article
 class: null
 field_plugin_method: null
@@ -36,7 +36,7 @@ process:
     default_value: migration_imported
   body:
     plugin: iterator
-    source: field_description
+    source: body
     process:
       value: value
       format:
@@ -93,6 +93,13 @@ process:
       title: title
       height: height
       width: width
+  field_source:
+    plugin: iterator
+    source: field_source
+    process:
+      uri: url
+      title: title
+      options: attributes
 destination:
   plugin: 'entity:node'
 migration_dependencies:

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

@@ -1,4 +1,4 @@
-uuid: fa50653c-58b8-4478-ac5f-27f725726acc
+uuid: 1c8c188b-7cb5-4062-ad62-e5eae3def31c
 langcode: en
 status: true
 dependencies: {  }

+ 8 - 2
web/modules/custom/materio_migrate/config/install/migrate_plus.migration.d7_node_article.yml

@@ -37,7 +37,7 @@ process:
     default_value: 'migration_imported'
   body:
     plugin: iterator
-    source: field_description
+    source: body
     process:
       value: value
       format:
@@ -94,7 +94,13 @@ process:
         title: title
         height: height
         width: width
-
+  field_source:
+    plugin: iterator
+    source: field_source
+    process:
+      uri: url
+      title: title
+      options: attributes
 
 migration_dependencies:
   required:

+ 10 - 0
web/modules/custom/materio_migrate/src/Plugin/migrate/source/D7NodeBreve.php

@@ -153,6 +153,16 @@ class D7NodeBreve extends FieldableEntity {
       }
     }
 
+    // make sure that field_source url is absolute
+    $field_source = $row->getSourceProperty('field_source');
+    if(isset($field_source[0]['url'])){
+      $url = $field_source[0]['url'];
+      if(!strpos($url, 'http://')){
+        $field_source[0]['url'] = 'http://'.$url;
+        $row->setSourceProperty('field_source', $field_source);
+      }
+    }
+
     // workflow
     $query = $this->select('workflow_node', 'wn');
     $query->fields('wn', ['sid']);