commerce_export-8.x-1.0-alpha1/config/install/migrate_plus.migration.import_paragraph_product_video.yml
config/install/migrate_plus.migration.import_paragraph_product_video.yml
# Import video paragraph type.
#
# Import one paragraph entity with video information. The paragraoh entity has
# two fields, one field contains an embedded text string and the other a
# thumbnail image.
#
# Destination site configuration:
# - Install the Paragraph Module.
# - Create a paragraph type with two fields, one for the embedded text and the
# other for an image field for the thumbnail.
#
id: import_paragraph_product_video
label: Paragraph product video
migration_group: commerce_export
source:
plugin: product_video_csv
path: 'public://import/product.csv'
header_row_count: 1
enclosure: '"'
keys:
- title
column_names:
0:
title: Title
1:
sku: SKU
27:
video1: 'Video 1'
28:
thumbnail1: 'Thumbnail 1'
constants:
video_embed_prefix: '<iframe width="560" height="315" src="'
video_embed_suffix: ' frameborder="0" allowfullscreen></iframe>'
process:
# Build a video embed tag, type text (plain, long), in two steps.
# First, add the prefix defined in the source constants.
field_video_embed_part1:
plugin: concat
source:
- 'constants/video_embed_prefix'
- video
# Second, add the suffix defined in the source constants.
field_video_embed:
plugin: concat
source:
- '@field_video_embed_part1'
- 'constants/video_embed_suffix'
# A single valued image field. Use migration_lookup to ensure the post migration fid for this file is used.
field_video_image:
plugin: migration_lookup
migration: import_image
source:
- sku
- thumbnail1
destination:
plugin: 'entity_reference_revisions:paragraph'
default_bundle: product_carousel_video
migration_dependencies:
required:
- import_image
