1 # A "migration" is, in technical terms, a plugin whose configuration describes
2 # how to read source data, process it (generally by mapping source fields to
3 # destination fields), and write it to Drupal.
5 # The machine name for a migration, used to uniquely identify it.
8 # A human-friendly description of the migration.
9 label: Migrate style categories from the source database to taxonomy terms
11 # The machine name of the group containing this migration (which contains shared
12 # configuration to be merged with our own configuration here).
15 # The category or tag for the migration.
19 # Every migration must have a source plugin, which controls the delivery of our
20 # source data. In this case, our source plugin has the name "beer_term", which
21 # Drupal resolves to the PHP class defined in
22 # src/Plugin/migrate/source/BeerTerm.php.
26 # Every migration must also have a destination plugin, which handles writing
27 # the migrated data in the appropriate form for that particular kind of data.
28 # Most Drupal content is an "entity" of one type or another, and we need to
29 # specify what entity type we are populating (in this case, taxonomy terms).
30 # Unlike the source plugin (which is specific to our particular scenario), this
31 # destination plugin is implemented in Drupal itself.
33 plugin: entity:taxonomy_term
35 # Here's the meat of the migration - the processing pipeline. This describes how
36 # each destination field is to be populated based on the source data. For each
37 # destination field, one or more process plugins may be invoked.
39 # The simplest process plugin is named 'get' - it is the default plugin, so
40 # does not need to be explicitly named. It simply copies the source value
41 # (the 'style' field from the source database in this case) to the destination
42 # field (the taxonomy term 'name' field). You can see we simply copy the
43 # source 'details' field to destination 'description' field in the same way.
47 # Here is a new plugin - default_value. In its simplest usage here, it is used
48 # to hard-code a destination value, the vid (vocabulary ID) our taxonomy terms
49 # should be assigned to. It's important to note that while above the right
50 # side of the mappings was a source field name, here the right side of the
51 # 'default_value:' line is an actual value.
54 default_value: migrate_example_beer_styles
56 # Here's another new plugin - migration. When importing data from another
57 # system, typically the unique identifiers for items on the destination side
58 # are not the same as the identifiers were on the source side. For example, in
59 # our style data the term names are the unique identifiers for each term,
60 # while in Drupal each term is assigned a unique integer term ID (tid). When
61 # any such items are referenced in Drupal, the reference needs to be
62 # translated from the old ID ('ale') to the new ID (1). The migration
63 # framework keeps track of the relationships between source and destination
64 # IDs in map tables, and the migration plugin is the means of performing a
65 # lookup in those map tables during processing.
67 plugin: migration_lookup
68 # Here we reference the migration whose map table we're performing a lookup
69 # against. You'll note that in this case we're actually referencing this
70 # migration itself, since category parents are imported by the same
71 # migration. This works best when we're sure the parents are imported
72 # before the children, and in this case our source plugin is guaranteeing
75 # 'style_parent' is the parent reference field from the source data. The
76 # result of this plugin is that the destination 'parent' field is populated
77 # with the Drupal term ID of the referenced style (or NULL if style_parent
81 # We'll learn more about dependencies in beer_node - here, we leave them empty.
82 migration_dependencies: {}
84 # By default, configuration entities (like this migration) are not automatically
85 # removed when the migration which installed them is uninstalled. To have your
86 # migrations uninstalled with your migration module, add an enforced dependency