Skip to content

Instantly share code, notes, and snippets.

@illepic
Last active June 6, 2016 06:40
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save illepic/b3a4d4c8815b71eb01bab879207b2c82 to your computer and use it in GitHub Desktop.
Save illepic/b3a4d4c8815b71eb01bab879207b2c82 to your computer and use it in GitHub Desktop.
In a Drupal 6 or Drupal 7 migration to Drupal 8, use the embedded_data migration source plugin to import inline, one-off data. Use this to, say, create new taxonomy terms in a vocabulary. Note the use of the "data_rows" and "ids" keys in the source. "term_name"s are being added to the vocabulary "classes" via the "default_value" process plugin.
langcode: en
status: true
dependencies: { }
id: upgrade_d6_taxonomy_term_classes
migration_tags:
- 'Drupal 6'
migration_group: migrate_drupal_6
label: 'Taxonomy terms for WoW character classes '
source:
plugin: embedded_data
# The uid's below are just there for unique keys, they do not carry over to Drupal
data_rows:
-
term_name: 'Death Knight'
uid: 666
-
term_name: 'Demon Hunter'
uid: 667
-
term_name: 'Druid'
uid: 668
-
term_name: 'Hunter'
uid: 669
-
term_name: 'Mage'
uid: 670
-
term_name: 'Monk'
uid: 671
-
term_name: 'Paladin'
uid: 672
-
term_name: 'Priest'
uid: 673
-
term_name: 'Rogue'
uid: 674
-
term_name: 'Shaman'
uid: 675
-
term_name: 'Warlock'
uid: 676
-
term_name: 'Warrior'
uid: 677
# "uid" is the key on our data that the migration can use for unique identifiers. Drupal still
# assigns proper tid's based on available tid's in the system
ids:
uid:
type: integer
process:
vid:
plugin: default_value
default_value: classes
name: term_name
destination:
plugin: 'entity:taxonomy_term'
migration_dependencies:
required:
- upgrade_d6_taxonomy_vocabulary
- upgrade_d6_taxonomy_term
- upgrade_d6_taxonomy_term_instance_size
optional: { }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment