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.
The line break filter in Drupal needs to be aware of all the block level html elements for it's current implementation to work. The function starts out by defining these:
function _filter_autop($text) {
// All block level tags
$block = '(?:table|thead|tfoot|caption|colgroup|tbody|tr|td|th|div|dl|dd|dt|ul|ol|li|pre|select|form|blockquote|address|p|h[1-6]|hr)';
You'll notice the html5 block level elements (e.g., section) are not included in this list. That means the link break filter (to inject p and br tags) will fail around these. We either need to add them to this list or develop an implementation that doesn't require these.
Comment | File | Size | Author |
---|---|---|---|
#2 | filter-autop-1280522-2.patch | 819 bytes | dcmouyard |
Comments
Comment #1
JacineNice catch @mfer! I knew there was another filter-related issue somewhere. ;) I added this to the roadmap. I think we should just keep it simple and add the new block-level elements to this line, because that's what pretty much what we ended up doing for filter_xss_admin().
Tagging this as a Novice patch as the following elements just need to be added to that line:
article|aside|details|figcaption|figure|footer|header|hgroup|menu|nav|section|summary
Comment #2
dcmouyard CreditAttribution: dcmouyard commentedHere's a patch.
Comment #4
iflista CreditAttribution: iflista commented#2: filter-autop-1280522-2.patch queued for re-testing.
Comment #6
mfer CreditAttribution: mfer commented#2: filter-autop-1280522-2.patch queued for re-testing.
Comment #7
JacineOk great, it was a testbot glitch and it's green now!
I just tested it and think it's good to go. Thanks again for the patch @dcmouyard!
Comment #8
Dries CreditAttribution: Dries commentedCommitted to 8.x. Thanks!