Advertising sustains the DA. Ads are hidden for members. Join today

Overview of migrate field plugins

Last updated on
11 March 2021

This documentation needs work. See "Help improve this page" in the sidebar.

Field plugins provide a direct upgrade solution from Drupal 6/7 fields to Drupal 8/9 equivalents.  They are responsible for handling the migration of custom fields and add processes to migrations for entities that have fields.

When you write custom migrate field plugins they:

List of core field plugins.

MigrateField example

The following example is the field plugin for Drupal 7 text fields.

@MigrateField(
  id = "d7_text",
  type_map = {
    "text" = "text",
    "text_long" = "text_long",
    "text_with_summary" = "text_with_summary"
  },
  core = {7},
  source_module = "text",
  destination_module = "text",
)

MigrateField annotation

  • The id property often matches the source field type. It does not in this example.
  • The  source_module is the name of the module on the source site that provides the field type.
  • The  destination_module is the name of the module on the destination Drupal 8/9 that provides the field type.
  • The core property is the Drupal version of the source site the provides the field type. If it the same for both Drupal 6 and Drupal 7 use {6, 7}.
  • The 'type_map' is an array in the format 'd6/d7_field_name' => 'd8/d9_field_name'.

Help improve this page

Page status: Needs work

You can: