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...

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

criz’s picture

Priority: Normal » Major

This 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.

JohnAlbin’s picture

> 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.

tohesi’s picture

Here'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.

tohesi’s picture

FileSize
1.35 KB
1.15 KB

Sorry, a new try with the variable names right..

idebr’s picture

Status: Active » Needs review
Pol’s picture

Status: Needs review » Reviewed & tested by the community

Hi,

This patch makes sense.

Thanks!

alex_optim’s picture

+1

  • Pol committed b663cb1 on 7.x-1.x
    Issue #2137295 by Pol, tohesi: Incorrect validation for custom wrapper...
Pol’s picture

Status: Reviewed & tested by the community » Fixed

Thanks!

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.