Closed (won't fix)
Project:
HTML Purifier
Version:
6.x-2.4
Component:
Miscellaneous
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
22 Jun 2011 at 01:21 UTC
Updated:
20 Feb 2012 at 23:12 UTC
Hi,
the htmlpurifier is deleting all forms. how I can change that?
Comments
Comment #1
jepster_*bump*
Comment #2
ezyang commentedThe backing library HTML Purifier does not support safe forms yet, as such, the Drupal module cannot support them.
Comment #3
jepster_so what should I do, to save my forms from removing?
Comment #4
traviscarden commentedI needed to do this, too. At present, the HTML Purifier library doesn't support it, but I found a (kind of ugly) workaround: the library actually does have a Forms HTML module, but it declares itself as unsafe, so the elements it defines are stripped. If you just change it to claim to be safe, HTML Purifier will let form elements through. In
sites/all/libraries/htmlpurifier/library/HTMLPurifier/HTMLModule/Forms.php, just change the following variable declaration (around line 9) toTRUE:The trouble with this approach is that you're hacking a third party library, so the next time you upgrade it, you'll have to make the change again, or it'll suddenly start stripping form elements again. To make sure I didn't forget, I created a custom module with the following code in the
MYMODULE.installto alert me (on the Status report page) if the hack gets reversed.It's kinda low tech, but it gets the job done. You could craft a more elegant solution if the library allowed you to include the Forms module via the API, but it doesn't appear it does at present. There's kind of a discussion of this on the library's forms.