Ran into an issue where a css class with two dashes added to a panelizer page gets reformatted to a single dash.

Comments

tom friedhof’s picture

Status: Active » Needs review
StatusFileSize
new736 bytes

This isn't the most elegant fix for this, but solves the problem.

damienmckenna’s picture

I would if check_plain would be sufficient?

damienmckenna’s picture

No, check_plain() would not be sufficient. I'm also not sure I like this change either, I think instead we should work on patching CTools to not strip multiple dashes and leverage that API change, rather than removing any string security we have from the string replacement.

This patch leverages a new option I submitted as a patch for CTools: #2287399: Allow ctools_cleanstring to retain multiple separator values

tom friedhof’s picture

StatusFileSize
new691 bytes

Here is another patch that makes more sense, using a core function to sanitize the css class.

damienmckenna’s picture

Maybe use drupal_html_class() instead?

Status: Needs review » Needs work

The last submitted patch, 4: panelizer_allow-double-dash-css_2287353-4.patch, failed testing.

tom friedhof’s picture

I guess it couldn't hurt to use drupal_html_class() instead, to ensure the same string isn't sanitized multiple times.

tom friedhof’s picture

StatusFileSize
new682 bytes
mglaman’s picture

Status: Needs work » Needs review
StatusFileSize
new645 bytes
new805 bytes

Patch works great, fixes big issue when using BEM/SMACSS workflow. Updated patch to remove unneeded include to call ctools_include('cleanstring');

  • DamienMcKenna committed 5ca23be on 7.x-3.x
    Issue #2287353 by tom friedhof, DamienMcKenna, mglaman: Use...
damienmckenna’s picture

Status: Needs review » Fixed

Committed. Thanks everyone!

Status: Fixed » Closed (fixed)

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

criz’s picture

Unfortunately using drupal_html_class() doesn't work for double underscores (element).
See #2009584: Allow double underscores to pass through drupal_clean_css_identifier as per new CSS standards.