-
-
Save asanchez75/9eaf8c87f80fd66dc90d06cce42ecb32 to your computer and use it in GitHub Desktop.
Drupal 8 migrations by example
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Professor ID | Title | Author | |
---|---|---|---|
P01 | The pushcart war | Jean Merrill | |
P02 | The definite guide to Drupal 7 | Benjamin Melançon et al. | |
P03 | The five love languages | Gary Chapman |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Professor ID | Photo URL | |
---|---|---|
P01 | sites/default/files/pictures/picture-2-1421176752.jpg | |
P02 | sites/default/files/pictures/picture-3-1421176784.jpg | |
P03 | sites/default/files/pictures/picture-15-1421176712.jpg |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Professor ID | First Name | Last Name | Department | Date | City | State | ZIP | Country Code | Biography | |
---|---|---|---|---|---|---|---|---|---|---|
P01 | Stefan | Freudenberg | Physics | July 17, 2006 | Hamburg | 21073 | DE | Part analyst, part troubleshooter, and part troublemaker, Stefan serves as Agaric's <em>secret weapon</em> and resident heretic. | ||
P02 | Benjamin | Melançon | Journalism | August 12, 2008 | Minneapolis | MN | 55111 | US | Benjamin lives and works to <strong>connect people, ideas, and resources</strong> so more awesome things happen. | |
P03 | Michele | Metts | Law | September 12, 2010 | Boston | MA | 02111 | US | Michele Metts has been a involved with <a href=”http://drupal.org”>Drupal</a> since 2006. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
id: mbe_book_paragraph | |
label: 'Import book paragraph' | |
source: | |
plugin: csv | |
path: ../migrate/mbe_book_paragraph.csv | |
header_row_count: 1 | |
keys: | |
- 'Professor ID' | |
process: | |
field_mbe_title: Title | |
field_mbe_author: Author | |
destination: | |
plugin: 'entity_reference_revisions:paragraph' | |
default_bundle: mbe_book | |
migration_dependencies: null |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
id: mbe_photo_field | |
label: 'Import photos of professors' | |
source: | |
constants: | |
SOURCE_BASE_PATH: 'http://agaric.com' | |
DRUPAL_FILE_DIRECTORY: 'public://professor_photo' | |
plugin: csv | |
path: ../migrate/mbe_photos.csv | |
header_row_count: 1 | |
keys: | |
- 'Professor ID' | |
process: | |
destination_filename: | |
- | |
plugin: callback | |
callable: basename | |
source: 'Photo URL' | |
- | |
plugin: skip_on_empty | |
method: row | |
destination_full_path: | |
- | |
plugin: concat | |
delimiter: / | |
source: | |
- constants/DRUPAL_FILE_DIRECTORY | |
- '@destination_filename' | |
- | |
plugin: urlencode | |
source_full_path: | |
- | |
plugin: concat | |
delimiter: / | |
source: | |
- constants/SOURCE_BASE_PATH | |
- 'Photo URL' | |
- | |
plugin: urlencode | |
uri: | |
plugin: file_copy | |
source: | |
- '@source_full_path' | |
- '@destination_full_path' | |
destination: | |
plugin: 'entity:file' | |
migration_dependencies: null |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
label: 'Import professors' | |
source: | |
plugin: csv | |
path: ../migrate/mbe_professors.csv | |
header_row_count: 1 | |
keys: | |
- 'Professor ID' | |
process: | |
type: | |
plugin: default_value | |
default_value: mbe_professor | |
title: | |
plugin: concat | |
source: | |
- 'First Name' | |
- 'Last Name' | |
delimiter: ' ' | |
field_mbe_biography/value: Biography | |
field_mbe_biography/format: | |
plugin: default_value | |
default_value: basic_html | |
field_mbe_department: | |
plugin: entity_generate | |
source: Department | |
entity_type: taxonomy_term | |
bundle: mbe_department_vocabulary | |
value_key: name | |
bundle_key: vid | |
field_mbe_photo/target_id: | |
plugin: migration_lookup | |
migration: mbe_photo_field | |
source: 'Professor ID' | |
field_mbe_photo/alt: | |
plugin: default_value | |
default_value: 'Professor headshot' | |
mbe_book_paragraph: | |
plugin: migration | |
migration: mbe_book_paragraph | |
source: 'Professor ID' | |
field_mbe_favorite_books: | |
plugin: iterator | |
source: | |
- '@mbe_book_paragraph' | |
process: | |
target_id: '0' | |
target_revision_id: '1' | |
field_mbe_experience_date: | |
plugin: format_date | |
source: Date | |
from_format: 'F d, Y' | |
to_format: Y-m-d | |
timezone: America/Managua | |
field_mbe_coworking_address/address_line1: | |
plugin: default_value | |
default_value: 'It is a secret ;)' | |
field_mbe_coworking_address/locality: City | |
field_mbe_coworking_address/administrative_area: State | |
field_mbe_coworking_address/postal_code: ZIP | |
field_mbe_coworking_address/country_code: 'Country Code' | |
destination: | |
plugin: 'entity:node' | |
migration_dependencies: | |
required: | |
- mbe_photo_field | |
- mbe_book_paragraph | |
optional: { } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment