Skip to content

Instantly share code, notes, and snippets.

@weaver299
Created February 14, 2019 22:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save weaver299/b24bd97d4341263c8452dfaa2acb3aba to your computer and use it in GitHub Desktop.
Save weaver299/b24bd97d4341263c8452dfaa2acb3aba to your computer and use it in GitHub Desktop.
id: media_images
label: Migrate image file entities
description: Migrate image file entities
migration_group: media
migration_tags:
- Custom
source:
plugin: file_entity
types:
- image
# constants:
# bundle: 'image'
#scheme: public
# constants:
# # The tool configuring this migration must set source_base_path. It
# # represents the fully qualified path relative to which URIs in the files
# # table are specified, and must end with a /. See source_full_path
# # configuration in this migration's process pipeline as an example.
# source_base_path: 'sites/default/files/legacy'
process:
mid: fid
bundle:
plugin: static_map
source: type
map:
image: image
document: file
application: file
video: embed_video
default: file
langcode:
plugin: default_value
source: language
default_value: "und"
name: filename
uid:
-
plugin: migration
migration: users
source: uid
-
plugin: default_value
default_value: 1
status: status
created: timestamp
changed: timestamp
field_media_image/target_id: fid
field_media_image/alt: field_file_image_alt_text/0/value
field_media_image/title: field_file_image_title_text/0/value
# # failed attempt to default to image filename when alt text is unavailable
# field_media_image/alt:
# -
# plugin: get
# source: field_file_image_alt_text/0/value
# -
# plugin: get
# source: filename
destination:
plugin: entity:media
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment