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 checkbox/radio widget provides an option for adding a hyphen in front of second-level items, but this doesn't allow for much theming. My request is that this module implement the same option provided by core taxonomy + betterselect, and add the following classes:
"checkbox-depth-x" -css for a checkbox with a depth of x
"radio-depth-x" -ditto for radios
"has-children" -css for any parent term
Example: a 3 level hierarchy with one term per level would look like this (in pseudo-code, anyway):
<div class = "checkbox-depth-0 has-children">
First Term
</div>
<div class = "checkbox-depth-1 has-children">
Second Term (child of 1st)
</div>
<div class = "checkbox-depth-2">
Third Term (child of 2nd)
</div>
Thanks for your consideration.
Comment | File | Size | Author |
---|---|---|---|
#4 | content_taxonomy.module.patch | 393 bytes | Mac Clemmens |
Comments
Comment #1
vodoleq CreditAttribution: vodoleq commentedSubscribe
Comment #2
YK85 CreditAttribution: YK85 commentedsubscribing
Comment #3
Mac Clemmens CreditAttribution: Mac Clemmens commentedThe current limitation stems from the function around line 265 of content_taxonomy.module
Changing it to something like this would enable us to add a span onto the label, but not the entire object.
When I get more time I'll take a look at the theming functions to figure out where an override would be, but maybe this little snippet will help point someone else in the right direction in the meantime.
Comment #4
Mac Clemmens CreditAttribution: Mac Clemmens commentedOK -- found a much simpler way to deal with this.
This patch gets content_taxonomy select lists to work with betterselect. It updates content_taxonomy to use the same indent formatter that the taxonomy module uses by default. This allows betterselect to properly handle the field.
Currently, taxonomy_content uses " - " to indent the terms, however, taxonomy just uses "-". The betterselect code counts on a single indent with no whitespace:
Comment #5
colemanw CreditAttribution: colemanw commentedGreat work!
Comment #6
Andrew Gorokhovets CreditAttribution: Andrew Gorokhovets commentedUnfortunately, it (#3, #4) is does not work for me.