Summary
In version 2.x, all things were built internally inside the drupal project. In 3.x, this project goes off the island and utilizes league/csv
. The library supports file streams for CSV files; a long requested feature. At the same time as introducing the library, this also gives us an opportunity to standardize the source configuration. See below for what that means.
If your site was not using composer previously, then you should either 1) switch to using composer or 2) download and add league/csv
in a location that can be found by drupal's autoloader. Really you might be happier to just switch to using composer or use 2.x of the project, which doesn't require composer.
Source plugin configuration changes
Both examples use a CSV that looks like:
# countries.csv
id,country
1,Nicaragua
2,Spain
3,United States
Before (2.x)
Minimal config options:
source:
plugin: csv
path: /tmp/countries.csv
keys: [id]
header_row_count: 1
process:
name: country
vid:
plugin: default_value
default_value: country
destination:
plugin: entity:taxonomy_term
All config options:
source:
plugin: csv
path: /tmp/countries.csv
keys: [id]
delimiter: ","
enclosure: "\""
escape: "\\"
header_row_count: 1
file_flags: 17
column_names:
-
id: ID
-
country: Country
file_class: Drupal\migrate_source_csv\CSVFileObject
process:
name: country
vid:
plugin: default_value
default_value: country
destination:
plugin: entity:taxonomy_term
After
Minimal config options:
source:
plugin: csv
path: public://countries.csv
ids: [id]
process:
name: country
vid:
plugin: default_value
default_value: country
destination:
plugin: entity:taxonomy_term
All config options:
source:
plugin: csv
path: public://countries.csv
ids: [id]
delimiter: ","
enclosure: "\""
escape: "\\"
header_offset: 0
fields:
-
name: id
label: ID
-
name: country
label: Country
process:
name: country
vid:
plugin: default_value
default_value: country
destination:
plugin: entity:taxonomy_term