Repeatability: always
Steps to repeat:
- Find a token which resolves to two separate words. Say for instance that the
[node:status]
token resolves toNot published
(even though it can actually resolve tounpublished
-- this is just an example. One could use any other token that yields characters not normally used for CSS identifiers.) - In Display Suite, create a CSS class using that token, for example
ds-node-status-[node:status]
. - In the Manage Display section of a content type, assign this class to a region.
- View the content, inspect the markup.
Expected results:
The region is assigned a single class ds-node-status-Not-published
.
Actual results:
The region is assigned two separate classes, such as ds-node-status-Not
and published
, because of the space character in the string returned by token_replace. I realize I can then use the CSS selector div.ds-node-status-Not.published
, but I don't think this is the intended way it's supposed to work.
Proposed (vague) solution:
The Not published
string returned by token_replace should be sanitized/cleaned, perhaps using Drupal's drupal_clean_css_identifier
function? I assume this should be used somewhere in the function ds_entity_variables
of ds.module
. I haven't been able to produce a working patch because I am a beginner in php/Drupal. I'm hoping someone more skilled will be able to propose a concrete solution.
Comments
Comment #2
leducvin CreditAttribution: leducvin commented