Drupal core is releasing media embed filters along with the media library in December. These entities should be tracked as well. They are virtually the same as a entity embed token, but with `` instead.
| Comment | File | Size | Author |
|---|---|---|---|
| #11 | Screen Shot 2020-02-21 at 12.21.17 PM.png | 271.05 KB | johnpicozzi |
| #9 | Screen Shot 2020-02-10 at 5.05.18 PM.png | 150.87 KB | johnpicozzi |
| #9 | Screen Shot 2020-02-10 at 5.05.05 PM.png | 102.78 KB | johnpicozzi |
| #8 | 3081407-8.patch | 9.26 KB | dsdeiz |
| #8 | interdiff.txt | 8.93 KB | dsdeiz |
Comments
Comment #2
marcoscanoThanks for contributing!
Maybe we can make it more explicit that this is from Drupal core? I'd say something like
Media WYSIWYG Embed (Core)could be more helpful to users?Here too, let's explain that this comes from Drupal core.
I actually think this could cause confusion on sites where core < 8.8, where this would do nothing. Maybe we should either:
- Add some temporary code in the form builder that removes this plugin from the list if core < 8.8 (preferred), or
- Improve this description to really make it clear that this option will only work with core >= 8.8
It seems that Drupal core only deals with media, so the
@data-entity-typerestriction is unneeded here?We will also need explicit test coverage for this.
Thanks!
Comment #3
oknateRe #2
1. How about "Core Media Embed" or "Media Embed (Core). It's a filter, and technically it was added before it displayed in the WYSIWYG.
3. I think it's right to keep the restriction for data-entity-type. The filter has this code:
foreach ($xpath->query('//drupal-media[@data-entity-type="media" and normalize-space(@data-entity-uuid)!=""]') as $node) {See \Drupal\media\Plugin\Filter\MediaEmbed::process()
So it won't process a drupal-media tag without the data-entity-type attribute. It was done this way to stay aligned with how Entity Embed works, see:
#2940029-63: Add an input filter to display embedded Media entities.4:
Comment #4
chris matthews commentedMy vote would be: "Tracks relationships created with Core's 'Embed media' filter in formatted text fields."
Comment #5
chris matthews commentedComment #6
wim leersYes, this would be really valuable to have! 🙏🥳
Comment #7
berdirDrupal 8.8 is out, so this isn't preparation anymore :)
Comment #8
dsdeiz commentedYeah, gave it a try. Wonder if this works.
Comment #9
johnpicozziWorking with Entity Usage with core Media and found this issue. Sounds like the problem I'm having. However, I can't seem to get the media usage for an image using the tag in my body to display correctly. I think I have the correct configuration setup as other images added using entity reference fields are displaying usage correctly. Am I missing a checkbox some place or do I need to update the text format or something. Perfectly willing to test this if someone can point me in the correct direction.
Here is my current config
Comment #10
dsdeiz commentedWere you able to enable the "Media WYSIWYG Embed (Core)" filter?
Comment #11
johnpicozzi@dsdeiz - Yes it would appear that that filter is enabled.
Comment #12
dsdeiz commentedSorry, I meant "Media WYSIWYG Embed (Core)" tracking plugin in /admin/config/entity-usage/settings under "Enabled tracking plugins". This should've been enabled upon a fresh install of entity_usage. Just did a quick manual test and seems working on my end. I added the image via the "Insert from media library" button for CKeditor from media_library module.
Comment #13
johnpicozzi@dsdeiz - I didn't see "Media WYSIWYG Embed (core)" in the list at first. I uninstalled and reinstalled the module and now it shows in the list. I re-ran the batch process and everything is working as expected. Thanks for the help!
Comment #14
chris burge commentedPatch #8 tests successfully for me.
<drupal-media>elements are being tracked correctly.Comment #16
marcoscanoCommitted, thanks all!
Comment #17
johnpicozziCan we tag another release of the module or re-roll the patch in #8 to work with beta2?
Comment #18
marcoscanoJust tagged beta3 which includes this.
Thanks everyone!