migrate_file_to_media-8.x-1.x-dev/src/Drush/Templates/media-migration-step2.yml.twig
src/Drush/Templates/media-migration-step2.yml.twig
# This migration links the newly created media entities with entity reference field on the target bundle.
id: {{ plugin_id }}_step2
label: {{ plugin_label }} Mapping
migration_group: {{ migration_group }}
source:
plugin: media_content_entity:{{ entity_type }}
bundle: {{ source_bundle }}
include_revisions: {{ include_revisions ? 'true' : 'false' }}
include_translations: {{ has_translation ? 'true' : 'false' }}
fields_not_empty:
{% for field_name in source_field_name %}
- {{ field_name }}
{% endfor %}
destination:
{% if include_revisions %}
plugin: media_entity_revision:{{ entity_type }}
{% else %}
plugin: entity:{{ entity_type }}
{% endif %}
{% if has_translation %} translations: true{% endif %}
process:
{{ id_key }}: {{ id_key }}
{% if include_revisions %}
{{ vid_key }}: {{ vid_key }}
{% endif %}
type:
plugin: default_value
default_value: {{ source_bundle }}
{% for field_name in source_field_name %}
{{ field_name }}_media:
plugin: file_id_lookup
source: {{ field_name }}
migration: {{ plugin_id }}_step1
no_stub: true
{% endfor %}
{% if has_translation %}
langcode: langcode
{% endif %}
migration_dependencies:
optional:
- {{ plugin_id }}_step1
dependencies:
module:
- {{ machine_name }}
enforced:
module:
- {{ machine_name }}
