I’m performing migration from Drupal 9 into another Drupal 9 project. Let’s say "content features" migration.
In a node migration I’m trying to create stubs for media items.
The media source has two id keys: mid, langcode
. The mid
key is getting from field’s target_id
property. But there is no language
property on field’s level and I’m trying to pass node’s language as second id value for the media lookup.
The migrate_lookup plugin tries to find media entity by mid and langcode properties: MigrationLookup::transform()
:
if (isset($this->configuration['source_ids'][$lookup_migration_id])) { $lookup_value = array_values($row->getMultiple($this->configuration['source_ids'][$lookup_migration_id])); }
then getMultiple()
tries to get values from the current iteration.
Does someone know how to pass root row instead of iteration row?
... process: langcode: langcode ... field_cover_image: - plugin: sub_process source: field_cover_image process: lang: plugin: default_value default_value: 'en' target_id: plugin: migration_lookup source: target_id migration: migrate_media_image source_ids: migrate_media_image: - target_id - ROOT_ROW_SOURCE_PROPERTY_LANGCODE
I wonder also if it possible to use constants within sub_process
and $row->getMultiple()
?
An example:
... process: target_id: plugin: migration_lookup source: target_id migration: migrate_media_image source_ids: migrate_media_image: - target_id - constants/default_language