Quantcast
Viewing latest article 2
Browse Latest Browse All 3

Answer by benj for Migrate address field

I do migrate from json to drupal 8, hope this will help.

In the .yml I call the field on a single value :

id: my_id_migratelabel: My Labelmigration_group: MyGroupmigration_dependencies: {}source:  plugin: json_source  path: URL_TO_JSON_FILE  headers:    Accept: 'application/json'  identifier: id  identifierDepth: 0  fields:    - id    - title    - addressdestination:  plugin: entity:nodeprocess:  type:    plugin: default_value    default_value: my_node_type  title: title  field_geolocation : geolocation  field_address : address

And 'address' is an array of all subfields :

.json source :

[   {"id":1,"title":"Title 1","address":{"address_line1":"adress 1","address_line2":"","postal_code":"11111","locality":"City of lights","country_code":"DE"      },   },   {"id":2,"title":"Title 2","address":{"address_line1":"adress 1 of number2","address_line2":"","postal_code":"11111","locality":"City of lights","country-code":"DE"      },   },   {"id":3,"title":"Title 3","address":{"address_line1":"adress 1 of number3","address_line2":"","postal_code":"11111","locality":"City of lights","country_code":"DE"      },   }]

Works with all subfields, and works fine for all fields in drupal 8 that have subfields (like geolocation fields for example)


Viewing latest article 2
Browse Latest Browse All 3

Trending Articles