I have filtered html text format set to limit allowed html tags (<a> <em> <strong> <ul> <ol> <li><p>
), I use also CKeditor with this format. I expected that Drupal would clean any other tags. This is happening after I save a node with text with some not-allowed tags and look at yet unpublished node's html - everything is stripped the way it should be.
However, if I open the node again and look on the code using ckeditors source button - the tags are there.
Were not the tags supposed to be deleted by Drupal? If not, what module can provide such functionality? Thank you.
1 Answer
Were not the tags supposed to be deleted by drupal?
No, the mantra in Drupal is "save the raw string, sanitise on output".
What you're seeing is the filter system working as designed.
As you mentioned in the comments, the Sanitizable (formatted text) module does exactly what you're looking for.
The Sanitize module allows administrators to configure a text format to be applied to formatted text before storage. This is useful to ensure clean and valid data in the database.
-
1thank you for answer, did not know this way things work in drupal:) This is answer to my second question drupal.org/project/sanitizable– loparrMar 26, 2015 at 18:13
-
That's great @loparr thanks for following up, I've incorporated that into the answer– Clive ♦Mar 26, 2015 at 18:21