You are here

migrate_plus.migration.mig_article_media_step1.yml in Migrate File Entities to Media Entities 8

migrate_file_to_media_d7_d8/config/install/migrate_plus.migration.mig_article_media_step1.yml

File

migrate_file_to_media_d7_d8/config/install/migrate_plus.migration.mig_article_media_step1.yml
View source
  1. # File to Media Migration configuration for Article Media migration
  2. id: mig_article_media_step1
  3. label: Article Media Step 1
  4. source:
  5. key: migration_source_db
  6. # Adapt it to your language
  7. langcode: und
  8. plugin: media_entity_generator_d7
  9. entity_type: node
  10. bundle: article
  11. d7_file_url: 'http://<d7-domain.tld>/sites/default/files/'
  12. field_names:
  13. - field_image
  14. # Using default language code unless other specified.
  15. langcode: 'und'
  16. destination:
  17. plugin: entity:media
  18. process:
  19. bundle:
  20. plugin: default_value
  21. default_value: image
  22. # Using the alt tag if available, else the file name.
  23. name:
  24. plugin: media_name
  25. source: file_name
  26. # This process plugin will skip the whole row if a existing media is found.
  27. existing_media_file:
  28. plugin: check_media_duplicate
  29. source: target_id
  30. # This process plugin will skip the whole row if a duplicate image is found.
  31. unique_file_id:
  32. plugin: check_duplicate
  33. source: target_id
  34. # Map the field image
  35. field_media_image/alt: alt
  36. field_media_image/title: title
  37. field_media_image/target_id:
  38. plugin: media_file_copy
  39. move: FALSE
  40. reuse: TRUE
  41. path: 'public://media/article/'
  42. source: file_path
  43. langcode: langcode
  44. uid:
  45. plugin: default_value
  46. default_value: 1