In my Drupal 8.4 installation I use the module File Entity. In the module are defined a few additional fields: 'author', 'title', 'alt',... My migration works. The files are imported, but the additional fields are after the import empty.
The complete YML (modules\my_migration_module\config\install\migrate_plus.migration.files.yml) looks like:
langcode: en
status: true
id: files
migration_group: import_xml
label: 'Import the test XML file'
source:
plugin: url
data_fetcher_plugin: file
urls: 'http://example.org/test.xml'
data_parser_plugin: xml
item_selector: /imports/files
fields:
-
name: id
label: ID
selector: ./@id
-
name: title
label: Title
selector: ./@title
-
name: alt
label: Alt
selector: ./@alt
-
name: author
label: Author
selector: ./@author
-
name: filename
label: Filename
selector: ./@filename
-
name: uri
label: URI
selector: ./@uri
-
name: target
label: Target
selector: ./@target
keys:
- id
ids:
id:
type: string
process:
field_alt: alt
field_title: title
field_author: author
filename: filename
uri:
plugin: download
source:
- uri
- target
destination:
plugin: 'entity:file'
source_path_property: uri
destination_path_property: target
template: null
E.g. for the field title I have tried:
field_title: title
title: title
field_title/field_title_value: title
field_title/field_title_value: title
field_title/field_title: title
file__field_titel/field_title_value: title
file__field_titel/field_title: title
I have found a solution for a similar problem in Drupal 7: How to migrate fields attached to files? I'm not sure, how can I implement this in Drupal 8.
simple_xml
instead ofxml
asdata_parser_plugin
? I also had a some problems with a XML import that were solved by changing nothing execpt the data_parser_plugin – Hudri Apr 13 '18 at 12:31