Media in Drupal 7 added fields to files but still handled things in a primitive way compared to what Media does today. Drupal 8 has Media in core with a dedicated Media entity.
File Entity and Media Entity were contrib modules that did something similar before Media was added to core.
Here is what Media WYSIWYG puts into the text field in D7:
This token references the image by file id and has some extra info to import. The problem is that this isn't recognized by Drupal 8's media embed filter.
Drupal 8 embed tokens
File image (using image button w/ file uploads).
Media image (using new Media Library button).
Entity Embed (using Entity Embed module). You may see this if a site was built before Media Library was available. You can configure your embed button for other content and use the new one for images.
You may see data-entity-uuid instead of data-entity-id. This is what I got from the Media Migration module.
Convert embedded view mode
Media elements will be created with data-view-mode="default".
Use dom_str_replace process plugin to change it.
body/0/value:
-
plugin: get
source: body/0/value
-
plugin: media_wysiwyg_filter
media_migrations:
- upgrade_d7_file_entity_image_public
file_migrations:
- upgrade_d7_file
-
plugin: img_tag_to_embed
migrations:
- upgrade_d7_file_entity_image_public
-
plugin: dom
method: import
-
plugin: dom_str_replace # Here's where the magic is.
mode: attribute
attribute_options:
name: data-view-mode
xpath: //drupal-media
search: default
replace: blog_image
-
plugin: dom
method: export
Migrations
Media still has outstanding issues for migrations:
https://www.drupal.org/project/drupal/issues/2930514
https://www.drupal.org/project/drupal/issues/2835825
https://www.drupal.org/project/drupal/issues/2885002
If you try to use Migrate Drupal UI to build your migrations:
Modules
Media Migration
https://www.drupal.org/project/media_migration
This provides a direct upgrade path from d7 -> 8 media.
Migrate File
https://www.drupal.org/project/migrate_file
Media Entity File Replace:
https://www.drupal.org/project/media_entity_file_replace
Media Library Importer
https://www.drupal.org/project/media_library_importer
File Ownage