Change record status: 
Project: 
Introduced in branch: 
8.0.x
Introduced in version: 
8.0.0-beta15
Description: 

In Drupal 8's core Migrate API, the closest thing to Migrate 7.x-2.x's dynamic migrations was load plugins.

The purpose of a load plugin is to "generate" several variations of a particular migration, when loading the base migration. An example is Migrate Drupal's deprecated d6_cck_field_values migration, which specifies a load plugin (note the load key):

id: d6_cck_field_values
label: Drupal 6 field values
migration_tags:
  - Drupal 6
load:
  plugin: drupal_entity
  bundle_migration: d6_node_type
source:
  plugin: d6_cck_field_values
process:
  nid:
    plugin: migration
    migration: d6_node
    source: nid
destination:
  plugin: entity:node

This means that, if you try to load a migration with the ID d6_cck_field_values:article, you will get a version of d6_cck_field_values specifically tailored for the fields that exist on the article node type. But this dynamic migration would never be saved into active configuration -- you would have to load it in order to know it exists at all! There was no simple way to tell which dynamic migrations would be made available by a load plugin, or what they’d look like. This trait made dynamic migrations extremely difficult to examine or debug. (Not only this, but dynamic migrations are only available thanks to a kludge in Migrate Drupal, so if you wanted to use dynamic migrations on top of the main Migrate API, you were pretty much out of luck.)

To address these problems, load plugins have been replaced by a new plugin type called builders. The concept is identical -- plugins to dynamically generate variations of a migration -- with the crucial difference that builders run ahead of time. They generate full-fledged migration entities based on your migration's source data (i.e., a Drupal or WordPress database, CSV file, XML feed, etc.). The generated migrations can optionally be saved into active configuration, but the important thing is that you can inspect and modify the dynamic migrations before they're ever executed.

Builders only apply to migration templates. If you want to use a builder to generate variations of a base migration, that migration must be provided as a template. Additionally, you must specify which build plugin to use.

An example, from core/modules/node/migration_templates/d6_node.yml -- note the builder key:

id: d6_node
label: Drupal 6 nodes
migration_tags:
  - Drupal 6
builder:
  plugin: d6_node
source:
  plugin: d6_node
process:
  nid: nid
  vid: vid
  type: type
  # ...More properties here...
destination:
  plugin: entity:node

This will cause the d6_node builder to generate variations of the template, based on what it finds in the source data. In this example, it would generate a migration for each node type (e.g., d6_node__page, d6_node__blog, and so forth), defining which CCK fields will be migrated for that type. Each of these variants can be saved into active configuration and inspected/altered before being executed.

Builders are plugins in the Plugin\migrate\builder namespace, implementing Drupal\migrate\Plugin\MigrateBuilderInterface.

Impacts: 
Site builders, administrators, editors
Module developers