Subfields for Migrate
Last updated on
24 December 2018
Drupal 7 will no longer be supported after January 5, 2025. Learn more and find resources for Drupal 7 sites
After the #1676646: make migrate field handler behave the same way as term reference: accept entity labels, allow creation of entities patch will be committed, there'll be available three new sub-fields for Entityreference field:
- source_type: If the option is set to
'name', there would be used text label of an entity, rather than its ID in the source column. - create_entity: If the option is set to
TRUE(or any other value different fromFALSE/0), and thesource_typeis set to'name', then if no entity was found for the given label, it will be created automatically. - ignore_case: If this option is
TRUE, then case differences (uppercase vs. lowercase) between source data and existing entity names will be ignored. The default behavior is to not ignore case.
$this->addFieldMapping('field_my_entityreference', 'entityreference_source_name');
$this->addFieldMapping('field_my_entityreference:source_type')
->defaultValue('name');
$this->addFieldMapping('field_my_entityreference:create_entity')
->defaultValue(TRUE);
$this->addFieldMapping('field_my_entityreference:ignore_case')
->defaultValue(TRUE);
Help improve this page
Page status: No known problems
You can:
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