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.
This is great, but it would be helpful for theming if there were some grouping divs added to the output, e.g. a group for each parent term and it's children.
Comment | File | Size | Author |
---|---|---|---|
#3 | Content Taxonomoy Tree out of the box | 10.85 KB | capellic |
#3 | After I applied the above CSS | 14.99 KB | capellic |
#2 | Picture 24.png | 12.5 KB | capellic |
Comments
Comment #1
sprugman CreditAttribution: sprugman commentedFWIW, my goal was to get 5 columns, one for each top-level term, instead of a big long list with 25 items. For anyone else who's interested in this, here's how I'm handling it at the moment:
First I tried to use form_alter, to add some divs around each parent and it's children, but I guess I don't understand how cck forms are built well enough to do that at the moment. Instead, I used the tree sub-module, and set it to "always expanded". Then in my admin theme, I added this css:
This allowed me to hide the images and expand collapse trigger. The #field-myField-tax-value-wrapper selectors are just to keep my changes local to this particular field. Also, if you don't have any Help text for the field, you'll have to come up with some other way from keeping the next field from merging into this one.
HTH
Comment #2
capellic@sprugman: That's an interesting solution. Maybe I'll give that a shot.
And I'll echo the need for some hierarchical div wrappers. I am able to achieve the following (image attached) with the Taxonomy Super Select module, but would like to be able to use CCK with my taxonomy.
Comment #3
capellicI ended up following @sprugman's lead installed Taxnonomy Manager and enabled Content Taxonomy Tree. Out of the box, Content Taxonomy Tree looks pretty nice. I've attached a screenshot.
Then I did some CSS of my own to get the desired, nested affect. Note that I removed the input field for the first tier terms because I want users to only select tier two. I also made tier one bold and tier two floating to save on vertical space. Here's the CSS I used along with a screenshot of the result. (Note that the font-face and all-caps seen in the screenshot are not included in this CSS.)
#field-myfieldname-value-wrapper .treeview .form-item label.option { font-weight: bold; }
#field-myfieldname-value-wrapper .treeview .treeview .form-item label.option { font-weight: normal; float: left; margin-right: 10px; }
#field-myfieldname-value-wrapper .lastCollapsable, #field-toi-value-wrapper .collapsable { clear: both; }
#field-myfieldname-value-wrapper .treeview .form-item input { display: none; }
#field-myfieldname-value-wrapper .treeview .treeview .form-item input { display: inline; }
#field-myfieldname-value-wrapper .treeview .collapsable { background:none }
#field-myfieldname-value-wrapper .treeview .last { background-image:none }
#field-myfieldname-value-wrapper ul.treeview li { background:none }
#field-myfieldname-value-wrapper .hitArea { display:none }
#field-myfieldname-value-wrapper .description { clear:both; padding-top:1em; }
Comment #4
Magnus CreditAttribution: Magnus commentedI used Taxonomy Super Select before and liked the way it output the terms. I guess I will have to use this aproach to be able to get it again with Content Taxonomy.
Thanks for the code!
Would be great if something like this would get into Content Taxonomy without the need to install Content Taxonomy Tree module.