1

I am migrating a Drupal 7 site that is using: drupal/wysiwyg:^2.9' (plus the ckeditor library) drupal/media:^2.27' drupal/media_ckeditor:^2.14'

In Drupal 7, when you insert an image into the wysiwyg body. The source code looks like this.

[[{"type":"media","view_mode":"media_large","fid":"532","field_deltas":{"1": 
{}},"link_text":null,"fields":{},"attributes":{"alt":"Image of a hand","height":"238","width":"278","style":"margin: 10px; width: 278px; height: 238px; 
float: right;","class":"media-image media-element file-media-large","data-delta":"1"}}]]

After migrating this site to Drupal 9 using drush. This source code still looks the same. Is there a way to convert this markup to the Drupal 9 embedded image markup. Which looks simular to this.

 <drupal-entity alt="uil" data-embed-button="file_browser" data-entity-embed- 
 display="image:image" data-entity-embed-display-settings=" 
 {&quot;image_style&quot;:&quot;&quot;,&quot;image_link&quot;:&quot;&quot;}" data-entity- type="file"
 data-entity-uuid="380923a6-e8b4-4b44-b0e5-c8d807aa6fef" data-langcode="en"> </drupal-entity>

Do I need to use this module on the Drupal 9 site? https://www.drupal.org/project/media_migration

2
1

Use module https://www.drupal.org/project/media_migration

Open your settings.php file and add this:

// Using module - Media Migration - use method - media_embed and uuid
// https://www.drupal.org/node/3135434
$settings['media_migration_embed_token_transform_destination_filter_plugin'] = 'media_embed';
// force using data-entity-uuid instead of data-entity-id
$settings['media_migration_embed_media_reference_method'] = 'uuid';

Go to your text format and checkbox tick 'Embed media'. Set it to use ckeditor Drag the media button onto the active toolbar.It is okay to check and use these filters:Align images, Caption images, Track images uploaded via a Text Editor

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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