At the moment, drupal_clean_css_identifier is used for creating the classes for roles, which doesn't run through a lower case filter . If you have a role labelled with capitals such as "Content Editor", you can't use the generated classes (user-role-Content_Editor) because they fail JSON validation.
Changing this to drupal_html_class fixes this.
Simple patch attached which fixes this, let me know if anything else needs to be done with this.
| Comment | File | Size | Author |
|---|---|---|---|
| #4 | json-errors-advanced-form.PNG | 16.07 KB | danielveza |
| #2 | 2874248-drupal-html-class-roles-2.patch | 586 bytes | danielveza |
Comments
Comment #2
danielvezaComment #3
dman commenteddrupal_html_class() sounds good.
Would applying this cause regression for any sites currently using the current configs though? If so, I'd need to put in an update hook to fix everyones old configs.
What is the 'JSON' validation that's failing?
Comment #4
danielvezaAttached an image of the JSON parsing fail for clarity. Any capitals in a class seems to make it fail.
I suspect it wouldn't need an update hook since you can't put any role classes with upper case characters into an advanced form rule at the moment and have it be parsed correctly.
Comment #5
dman commentedlooks like a helpful error message! Queer quoting. I wonder what's causing that.
If it's always been broken/unusable, then yeah, no update needed.
Comment #6
dman commentedWas due to the syntax not being real json in the first place, and my handmade tokenizer getting it wrong
Comment #7
dman commentedmay have been what was needed there,
Still, lower-casing everything as a policy also has merits.
Comment #9
dman commentedDone both.
Repaired the tokeniser, and also flattening the class that's getting applied for roles.
Cheers!
Comment #11
dman commentedTODO: one day switch to proper JSON in the configs there I guess.
Being almost-but-not-quite JSON is a silly thing. But JSON quoting is its own PITA to deal with in the UI, so I'd provided a relaxed interpreter there to be more succinct and easier for the admin. :-/