migrate_file_to_media-8.x-1.x-dev/migrate_file_to_media_d7_d8/config/install/migrate_plus.migration.mig_article_media_step1.yml

migrate_file_to_media_d7_d8/config/install/migrate_plus.migration.mig_article_media_step1.yml
# File to Media Migration configuration for Article Media migration

id: mig_article_media_step1
label: Article Media Step 1

source:
    key: migration_source_db
    # Adapt it to your language
    # set null to migrate all languages into source language
    langcode: null
    # source language that will be used for the destination entity
    # if langcode is 'null' or 'und'
    source_langcode: en
    plugin: media_entity_generator_d7
    toggle_media_mapping: true
    entity_type: node
    bundle: article
    d7_file_url: 'http://<d7-domain.tld>/sites/default/files/'
    field_names:
        - field_image
    # Using default language code unless other specified.
    langcode: 'und'

destination:
    plugin: entity:media

process:
    bundle:
        plugin: default_value
        default_value: image

    # Using the alt tag if available, else the file name.
    name:
        plugin: media_name
        source: file_name

    # This process plugin will skip the whole row if a existing media is found.
    existing_media_file:
        plugin: check_media_duplicate
        source: target_id

    # This process plugin will skip the whole row if a duplicate image is found.
    unique_file_id:
        plugin: check_duplicate
        source: target_id

    # Map the field image
    field_media_image/alt: alt
    field_media_image/title: title
    field_media_image/target_id:
        plugin: media_file_copy
        move: FALSE
        reuse: TRUE
        path: 'public://media/article/'
        source: file_path

    langcode: langcode

    uid:
        plugin: default_value
        default_value: 1

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

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