Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
I'm trying to use HTML Purifier along Media 2.x inside WYSIWYG + CKEditor 4.3 with MediaElement.js as a video player.
Everything works great without the HTML Purifier filter on my text format. The generated HTML looks something like this :
<div class="mediaelement-video media-element file-default" data-file_info="%7B%22fid%22:%229%22,%22view_mode%22:%22default%22,%22fields%22:%7B%22format%22:%22default%22%7D,%22type%22:%22media%22%7D">
<video class="mediaelement-formatter-identifier-1385012495-4" controls="controls" src="http://crires.dev/sites/crires/files/stuckkey.mp4" height="385" width="640"> </video>
</div>
Am I to understand that I'd have to implement a custom HTML Purifier filter to support the video and audio HTML5 tags along with their attributes ?
Isn't there a way to whitelist these ??
Comment | File | Size | Author |
---|---|---|---|
#6 | support-for-html-purifier-2140645-3.patch | 1.36 KB | silverham |
| |||
#5 | support-for-html-purifier-2140645-2.patch | 2.98 KB | silverham |
| |||
#5 | support-for-html-purifier-2140645-1.patch | 1.35 KB | silverham |
|
Comments
Comment #1
heddnHi, can you change this into a feature request? There's support for youtube upstream in the library, but that support isn't in the Drupal module. I'll always accept patches.
http://htmlpurifier.org/docs/enduser-youtube.html
Comment #2
PascalAnimateur CreditAttribution: PascalAnimateur commentedComment #3
heddnPostponing until a patch is provided.
Comment #4
silverham CreditAttribution: silverham at EY Digital commentedComment #5
silverham CreditAttribution: silverham at EY Digital commentedAttached is 2x patches.
First I recommend immediately "support-for-html-purifier-2140645-1.patch" for images, adding data attributes.
(Requires requires at least 7.x-1.0+6-dev of htmlpurifer module.)
Secondly the second "support-for-html-purifier-2140645-2.patch" can be seen as needing further review or not committed as required.
Further reading:
#1321490-27: HTML5 Support?
https://github.com/xemlock/htmlpurifier-html5/blob/master/library/HTMLPurifier/ChildDef/HTML5/Media.php
Comment #6
silverham CreditAttribution: silverham at EY Digital commentedUpdated to add _alter() to function comment. to path 1. (so now it's "support-for-html-purifier-2140645-3.patch")