Document how to use MediaWysiwygFilter on custom migrations

Created on 14 December 2020, about 4 years ago
Updated 29 March 2023, over 1 year ago

For sites that are doing customized migrations, e.g. only using pieces of the full configuration generated by migrate_upgrade, it would be useful to provide more documentation on how to make MediaWysiwygFilter work.

✨ Feature request
Status

Closed: duplicate

Version

1.0

Component

Documentation

Created by

πŸ‡ΊπŸ‡ΈUnited States DamienMcKenna NH, USA

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • πŸ‡ͺπŸ‡ΈSpain pcambra Asturies

    Thanks for this module, it's saved me a lot of time.
    Just to add to this discussion, I've used the media_wysiwyg_filter standalone in a custom migration and had to alter the plugins to stop depending on d7_file_plain:image:public and d7_file_entity:image:public which I don't use, like so:

    /**
     * Implements hook_migration_plugins_alter().
     */
    function my_module_migration_plugins_alter(array &$migrations) {
      $migration_ids = [
        'upgrade_d7_node_complete_article',
        'upgrade_d7_node_complete_page,
      ];
      $dependencies_to_remove = [
        'd7_file_plain:image:public',
        'd7_file_entity:image:public',
      ];
      foreach ($migration_ids as $migration_id) {
        $dependencies = $migrations[$migration_id]['migration_dependencies'];
        $dependencies['required'] = array_diff($dependencies['required'], $dependencies_to_remove);
        $migrations[$migration_id]['migration_dependencies'] = $dependencies;
      }
    }
    

    Then used the process plugin normally on the migration:

      body/value:
        -
          plugin: get
          source: body/0/value
        -
          plugin: media_wysiwyg_filter
          view_mode_matching:
            default: full
          media_migrations:
            - upgrade_d7_media_images
          file_migrations:
            - upgrade_d7_file
    

    Worth saying that I had much better results in terms of visualization with entity embed than media embed, but the transformation worked very well.

Production build 0.71.5 2024