Adds migration configs.
This commit is contained in:
@@ -0,0 +1,72 @@
|
||||
# Migration configuration for creating media items.
|
||||
id: cdesai_profile_pages_media_items
|
||||
label: Import Profile Page Media
|
||||
migration_group: CDESAI_MEDIA
|
||||
|
||||
source:
|
||||
# The custom CSV source plugin will fetch the source path from configs.
|
||||
# Upload source files at /admin/config/development/cdesai/migrate.
|
||||
plugin: 'cdesai_migrate_csv'
|
||||
source_config_key: cdesai_migrate_profile_pages_source
|
||||
|
||||
delimiter: ','
|
||||
enclosure: '"'
|
||||
header_offset: 0
|
||||
|
||||
ids:
|
||||
- page
|
||||
|
||||
process:
|
||||
pseudo_destination_filename:
|
||||
# Skips a row if has_images property is set to FALSE.
|
||||
-
|
||||
plugin: skip_on_value
|
||||
equals: true
|
||||
source: has_images
|
||||
value: 'FALSE'
|
||||
method: row
|
||||
-
|
||||
plugin: skip_on_empty
|
||||
method: row
|
||||
message: 'Cannot import image file with an empty url.'
|
||||
-
|
||||
plugin: callback
|
||||
callable: basename
|
||||
source: image_url
|
||||
|
||||
name: '@pseudo_destination_filename'
|
||||
|
||||
field_media_image/target_id:
|
||||
plugin: migration_lookup
|
||||
migration: cdesai_profile_pages_image_files
|
||||
source: page
|
||||
|
||||
field_media_image/alt: title
|
||||
|
||||
thumbnail/target_id:
|
||||
plugin: migration_lookup
|
||||
migration: cdesai_profile_pages_image_files
|
||||
source: page
|
||||
|
||||
thumbnail/alt: title
|
||||
|
||||
uid:
|
||||
plugin: default_value
|
||||
default_value: 1
|
||||
|
||||
langcode: en
|
||||
|
||||
destination:
|
||||
plugin: 'entity:media'
|
||||
default_bundle: image
|
||||
|
||||
# make sure these migration execute before running current migration
|
||||
migration_dependencies:
|
||||
required:
|
||||
- cdesai_profile_pages_image_files
|
||||
|
||||
# use forced module dependency so uninstall/reinstall works properly
|
||||
dependencies:
|
||||
enforced:
|
||||
module:
|
||||
- cdesai_migrate
|
||||
Reference in New Issue
Block a user