On this page
Advanced field mappings
Some field types are more complex than others - in particular, they support a number of options controlling their behavior, or subfields providing additional data. These options or subfields can be mapped like regular fields - for example, to map the summary subfield of a text field:
$this->addFieldMapping('field_text', 'main_text');
$this->addFieldMapping('field_text:summary', 'teaser_text');
You can view all of the available subfields either in the migrate UI under the destination's tab for a specific migration or by using the drush migrate-fields-destination command. Just like regular field mappings if you leave a subfield un-mapped it will assume the Drupal default value for that column which varies depending on the type of field in question.
One common example is the 'language' subfield - this indicates the value of the field when requested for a given language and many fields have this additional data. The default is LANGUAGE_NONE ('und') - the default value when a specific language is not requested. If you were importing translated data you may want to set the appropriate language code with something like the following:
$this->addfieldMapping('field_name:language')->defaultValue('de');
Text fields
Text fields (fields with machine names of 'text', 'text_long', or 'text_with_summary') have the following subfields:
- summary: A short version of the contents of the field (i.e., a "teaser" or "excerpt").
- format: The Drupal text format to apply when displaying the field (e.g., "filtered_html").
Term reference fields
Term references on Drupal 7 (fields of the type 'taxonomy_term_reference') have the following options:
- source_type: If the option value is 'tid', then the incoming value is assumed to be a valid term ID in the destination Drupal instance. Otherwise, it is assumed to be a term name (the default behavior). Note that you'll want to set this to 'tid' if the mapping has a source migration (the sourceMigration() method is used on the mapping).
- create_term: If this option is TRUE (or any value not FALSE/0/etc.) and source_type is not 'tid', then if the name passed as the value here does not already exist in the destination vocabulary, it will be created. The default behavior is to not create a term.
- ignore_case: If this option is TRUE, then case differences (uppercase vs. lowercase) between source data and existing term names will be ignored. The default behavior is to not ignore case.
$this->addFieldMapping('field_taxonomy_reference', 'legacytermid')
->sourceMigration('LegacyTermMigration');
$this->addFieldMapping('field_taxonomy_reference:source_type')
->defaultValue('tid');
$this->addFieldMapping('field_tags', 'termname');
$this->addFieldMapping('field_tags:create_term')
->defaultValue(TRUE);
$this->addFieldMapping('field_tags:ignore_case')
->defaultValue(TRUE);
Migrate UI wizard
In the Migrate UI wizard, terms will not be mapped automatically. Via #2063203: Automatically map term references using the UI:
- Go to the field mapping editor for your node content type migration.
- For any term reference fields, set the source field to the appropriate vocabulary on your source system, and set the source migration to the migration of that vocabulary.
- Right under the term reference field, there will be a ':source_type' subfield - set the default value in that row to "tid".

Help improve this page
You can:
- Log in, click Edit, and edit this page
- Log in, click Discuss, update the Page status value, and suggest an improvement
- Log in and create a Documentation issue with your suggestion