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 field for adding a custom CSS class to use in the wrapper tag for the title incorrectly marks valid classes as invalid.
The validation uses drupal_html_class() to check if this field value is correct, but that function is simply a helper function to convert any text into a valid css class. It does not check whether that value is valid.
Here's a good reference for valid characters: http://stackoverflow.com/questions/448981/what-characters-are-valid-in-c...
Comment | File | Size | Author |
---|---|---|---|
#4 | interdiff-2137295-3-4.txt | 1.15 KB | tohesi |
#4 | incorrect_validation-2137295-4.patch | 1.35 KB | tohesi |
Comments
Comment #1
crizThis issue prevents people from defining and using a sustainable system-agnostic components-based html structure in Drupal 7.
If this module is not supporting widely used html standards like BEM or other frameworks it should be considered as a major bug.
See discussion in #2009584: Allow double underscores to pass through drupal_clean_css_identifier as per new CSS standards to see why drupal_html_class() shouldn't be used to validate html classes.
Comment #2
JohnAlbin> See discussion in #2009584: Allow double underscores to pass through drupal_clean_css_identifier as per new CSS standards to see why drupal_html_class() shouldn't be used to validate html classes.
I'm still fighting back on that one, fyi.
Comment #3
tohesi CreditAttribution: tohesi at Wunder commentedHere's an attempt to bypass the problem using drupal_clean_css_identifier() directly. Certainly not ideal but at least something to allow those BEM classes.
Comment #4
tohesi CreditAttribution: tohesi at Wunder commentedSorry, a new try with the variable names right..
Comment #5
idebr CreditAttribution: idebr as a volunteer and at One Shoe commentedComment #6
PolHi,
This patch makes sense.
Thanks!
Comment #7
alex_optim+1
Comment #9
PolThanks!