commerce_export-8.x-1.0-alpha1/config/install/migrate_plus.migration.import_image.yml

config/install/migrate_plus.migration.import_image.yml
# Imports image files into the files_managed table.
#
# Imports up to 3 files per row.
#
# Destination site configuration:
#   - Install the File Module.
#
id: import_image
label: Images for products and variations
migration_group: commerce_export
source:
  plugin: image_csv
  path: 'public://import/product.csv'
  header_row_count: 1
  enclosure: '"'
  keys:
    - sku
    - image
  column_names:
    1:
      sku: 'SKU'
    24:
      image1: 'Image 1'
    25:
      image2: 'Image 2'
    26:
      image3: 'Image 3'
    28:
      thumbnail1: 'Thumbnail 1'
    30:
      thumbnail2: 'Thumbnail 2'
    32:
      thumbnail3: 'Thumbnail 3'
    41:
      cta_image1: 'CTA product image 1'
    44:
      cta_image2: 'CTA product image 2'
  constants:
    base_path: 'public://images'
process:
  # Path to the source file.
  full_path:
    -
      plugin: concat
      delimiter: /
      source:
        - 'constants/base_path'
        - image
    -
      plugin: urlencode
  filename: image
  # Copy the files from the source to the destination. Here the source files have been moved to the destination
  # by some other, probably faster, means. If the source and destination are the same, no copy action takes place.
  uri:
    plugin: file_copy
    source:
      - '@full_path'
      - '@full_path'
  # Assign a uid to the file, default to 1.
  uid:
    plugin: default_value
    source: image_uid
    default_value: 1
  status:
    plugin: default_value
    default_value: 1
destination:
  plugin: 'entity:file'

Главная | Обратная связь

drupal hosting | друпал хостинг | it patrol .inc