Hi, back in the release notes for d7 it says "* Field API improvements: Taxonomy terms are now fields, comments and taxonomy terms are fieldable". Sweet. But I can't figure out how to assign specific fields to specific terms in a vocabulary. For hypothetical example:

Beverages
- tea
- soda
- juice

I'd like both tea and soda to have a 'caffeinated' (Yes/No) field associated with it. While juice has a 'fresh squeezed' (Yes/No) field associated with it.

I know I can attach fields to a vocabulary but it would be wrong to present a user with a caffienated yes/no choice if they are selecting 'juice'.

I know I can modify forms with hook_form_alter, add specific fields and write their contents to custom tables (that's actually what I did for testing purposes) but as the real vocabulary grows that method isn't viable. Am I missing something obvious? Thanks in advance for any pointers.

Comments

naught101’s picture

Status: Active » Fixed

I don't think this does what you want it to do. That note is slightly misleading, in that it uses the same wording for two different concepts.

Taxonomy term selectors/autocompletes on entities (eg. node, comments) are now fields. These act a bit like the old node_reference field in CCK.

Taxonomy terms themselves are now entities. So basically, the taxonomy selector on your nodes are just pointers to the actual taxonomy term entities. These terms can have fields, but there is no interface to add these field in d7 core. There may be one in contrib, but I couldn't find it with a quick search.

Even if you add fields to the taxonomy term entity, you probably won't be getting what you want. Then you'll just have a term "soda" with the field data "caffeinated= yes", and if you reference that, you'll always be referencing caffeinated soda (you won't have an option on your node form).

What you probably want to do is have two separate taxonomy terms, one for each type of soda, or even something like:
-soda
--> caffeinated
--> non-caffeinated

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.