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.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

sprugman’s picture

FWIW, 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:

#field-myField-tax-value-wrapper .treeview li { float:left; background:none; width:19%; padding-left:0; }
#field-myField-tax-value-wrapper .treeview li li { float:none; width:100%; padding-left:15px; }
#field-myField-tax-value-wrapper .treeview .collapsable { background:none }
#field-myField-tax-value-wrapper .treeview .last { background-image:none }
#field-myField-tax-value-wrapper ul.treeview li { background:none }
#field-myField-tax-value-wrapper .hitArea { display:none }
#field-myField-tax-value-wrapper .description { clear:both; padding-top:1em; }

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

capellic’s picture

FileSize
12.5 KB

@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.

capellic’s picture

I 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; }

Magnus’s picture

I 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.