2

I imported the content of a website from Drupal 7 to Drupal 8, but some nodes contain something like this.

[[{"type":"media","view_mode":"media_large","fid":"403","attributes":{"alt":"","class":"media-image","height":"187","style":"display: block; margin-left: auto; margin-right: auto;","typeof":"foaf:Image","width":"480"}}]]

In Drupal 7 this is fixed by setting the filter "Convert Media tags to markup", which does not exist in Drupal 8.

How can I fix this in Drupal 8?

1

2 Answers 2

1

Your media token snippet is from the Drupal 7 Media library and WYSIWYG integration.

I don't know if that integration exists yet in Drupal 8. It would apart of, listed as a project of the Media Entity project for drupal 8.

EDIT

You want to see the Entity Embed module for Drupal 8 which supports WYSIWYG editors. I don't know if they offer a migration of old media content into this new module though.

These modules were found by these blog resources and DrupalCamp sessions which have a Youtube video showing these modules in action:

0

In my case:

  • source D7
  • destination D8 (i have not been able to make it work in D9 yet)
  • source uses media_wysiwyg

in destination enable media_migration

in settings.php add:

$settings['media_migration_embed_token_transform_destination_filter_plugin'] = 'media_embed';

run the migration.

@huzooka has added a lot more detailed instruction is media_migration readme.

Update

Looks like in D9 I have to :

a) actually call the plugin and

b) match the display modes

This worked:

 body:
    -
      plugin: sub_process
      source: body
      process:
        value: value
        summary: summary
        format:
          plugin: default_value
          default_value: cc_wysiwyg
    -
      plugin: media_wysiwyg_filter
      view_mode_matching:
        default: full
        full: full
        teaser: teaser
        small: medium

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.