Problem/Motivation
As a sitebuilder, I expect that when I don't have Entity Embed installed on the migration destination site, then media_wysiwyg tokens are transformed to Media Library HTML entities and the migration ends in a fully viewable content entity with properly rendered embed media entities.
Proposed resolution
- Way to define which filter_plugin should be the destination plugin type for Media Migrate's transformation. BC:
entity_embedshould be the default/fallback. - Tweak the migrate system somehow to be able to reference the embed media entities by their UUID instead of their ID: the
media_embedplugin (Media Library module) only allows UUID references. - Migrate as much data from the embed code as possible.
Comments
Comment #2
huzookaAttaching a WIP patch that is built on top of #3128540-4: Follow up for #3096596: MediaWysiwygFilter assumes that File::getDownloadToken is always available and #3128342: Harden media_filter (filter plugin of Drupal 7 Media WYSIWYG) → entity_embed token transform.
Comment #3
huzookaComment #4
huzookaRebased (WIP) patch on top of #3128342-6: Harden media_filter (filter plugin of Drupal 7 Media WYSIWYG) → entity_embed token transform (comment #6).
Comment #5
huzookaComment #6
huzookaPatch on top of #3126214: Make Media Migration compatible with Drupal 9 and #3128342: Harden media_filter (filter plugin of Drupal 7 Media WYSIWYG) → entity_embed token transform, please ignore...
Comment #7
wim leersAwesome work here 🥳
Hm, is
media_librarya "token type"? :O I have no idea what this refers to 🙈s/embed media filter/media_filter/
🥳
But let's not use
data-*, let's usedata-entity-type data-entity-uuid data-view-mode data-align data-caption.Comment #8
huzookaComment #9
huzookaComment #10
huzooka.
Comment #11
huzookaTest added.
This is basically a heavily reworked version of #6.
I have to create a change record about the new `media_embed` token destination option.
Comment #12
huzookaComment #13
huzookaComment #14
huzooka(Edited.)
Comment #15
huzookaComment #16
huzookaI had to fix some nits to be able to support Drupal core 8.7.x.
Comment #17
wim leersI basically have only nits and a few small questions — really impressive work here!
I believe this infrastructure — and especially the test infrastructure — paves the path for many more
<some D7 module that does something with media>to migrate into D8/9 🥳🥳These two BC choices make sense for existing
media_migrationusers 👍👍 — you preemptively answered a question I was going to ask! :D
OOOOOOOOOHHHHHHHHHHHHHH! 😍👏
Shouldn't this also specify "with the same machine names"?
Eye for detail! 👏
Again, eye for detail! 👍
I think the comment here should say that
MEDIA_TOKEN_DESTINATION_FILTER_MEDIA_EMBEDwould actually be the correct default, but doing that would cause a BC break in themedia_migrationmodule.Why isn't
medialisted there?Yes,
mediais part of core and hence always exists but it is not always installed?🐛
media_filter→media_wysiwyg🐛
Media Library→MediaNit: s/uninstalled/not installed/ (subtle difference in meaning: "uninstalled" implies that it was previously installed and now not anymore).
Nit: s/tag's/tags/
Shouldn't this throw an an exception? When can this case occur?
😍 Woah, I had no idea you were tackling this too!
This comment doesn't seem to add anything — let's remove it.
s/a media_wysiwyg/a media_wysiwyg token/
Impressive robustness! 💯
👏
Why is this classname plural?
This seems wrong? Why would the
fullview mode for Media only exist iffile_entityexists?Oh, to migrate it.
But how could a
fullview mode forfile_entitybe migrated from 7 to 8'smedia? 🤔🥳
Übernit: s/format_plugin/format plugin/
Can you explain this in some more detail?
Nit: s/change/changed/
BEAUTIFUL 😍
👍 for this comment!
Comment #18
huzooka@Wim Leers, thanks for the review!
I fixed almost everything.
Re #17.13: that default case is unreachable because I throw an exception above if the format is not valid. So I removed that :)
However, I kept #17.20:
Comment #19
wim leers👍
👍
💯
Comment #20
huzookaComment #21
huzookaThis issue caused the test failures: #3133305: Use \Drupal::VERSION to get the version in Migrate UI rather than hardcoding it.
Comment #22
wim leersComment #24
huzooka