简体   繁体   中英

Is it possible to add custom fields to a Drupal taxonomy term?

I'd like to add a date field to a drupal taxonomy term, alongside the default "title" and "description"

Is there some technique/php/module that lets me do this? Is it possible to do with CCK??

I need to be able to display the new field in the same view presenting the content nodes referencing the term.

At the moment, I've added a date field to the content nodes with CCK, and it's displayed by the view. But that's not exactly what I'm going for, I just want to update one date per term.

Attaching fields to terms is added in Drupal 7, but that's still beta. I'd suggest replacing your taxonomy with a node reference field in Drupal 6.

There's a module to do exactly this: Term Fields . Some more details about this module (from its project page):

Term Fields allows you to define fields for taxonomy terms in the same way that CCK allows you to define fields for nodes.

Possible uses for this module

  • You own a book review site where you use the Taxonomy module to classify book reviews by the book author. You've created a view that lists all book authors on the site, but instead of just listing the author's name, you'd like to include some biographical information as well, such as the author's date of birth.
  • You have a video game fansite where your classify news, reviews, and images with a vocabulary where all the terms are games. You want to create an index of all games on your site, but instead of just listing the name of the game, you want to list the game's release date, publisher and platform.
  • You have a recipes site where recipes are nodes and are classified with a vocabulary where the terms are the chefs who created the recipes. Again, you want to list all the chefs with a view, but you also want to list their favorite recipe next to their name.

Any situation where taxonomy terms need more than just a title and a description is where Term Fields comes in to use.

As Scott said, Drupal 7 has this as part of core. There are some modules that attach nodes to taxonomy (eg Taxonomy Node ) that might also be helpful to look at.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM