When displaying the terms for a node, it would be desirable in some contexts to have a vocabulary-specific list instead of the default list of all matching terms.
For example, consider a posting that represents a farm, categorized by (a) products produced, (b) farming practices, (c) location, etc. By default, it would display as follows:
Submitted by Tracy Brock on Mon, 06/14/2004 - 22:20.
beans | certified organic | corn | Fruits and Berries | gooseberries | Grainery | herbs | Nanaimo | Pacific Agricultural Certifcation Society (PACS) | peas | Producers | raspberries | rye | vegetables, various
But it would be useful to be able to separate out the different vocabularies, to see at a glance, for instance, products produced, as follows:
Farming Practices
Location
Membership
Products
Resource Type
The attached patch introduces a new vocabulary setting, link_display, to allow site admins to select either the default display of terms for a node ("top") or, if prefered, a vocabulary-specific breakout in the body of the node display ("body"). It's implemented using the _nodeapi() "view" option. Also included are patches for the database.mysql and database.pgsql files to introduce a new field into the vocabulary table.
| Comment | File | Size | Author |
|---|---|---|---|
| taxonomy-select-link-list-type-patch.zip | 2.76 KB | nedjo |
Comments
Comment #1
nedjoNo response as yet, so I'll try to do a better job of explaining the advantages of this patch!
While it's most used for simple sections of a website, the taxonomy system enables rich relational database functionality. For any data type, it can track multiple "one-to-many" or "many-to-many" relationships. For example, using no more than the existing taxonomy system, it would be possible to track, for a company node type, multiple products, customers, projects, and staff (each of these being a separate vocabulary).
The current way of displaying linked terms for a node - lumping them together in an alphabetical list with no indication of what vocabulary they are from - makes sense for the "sections of a website" use, but doesn't take full advantage of the taxonomy system's ability to provide multiple categorizations. For the company example, it would be preferable to separate out, e.g., products as a distinct listing.
This patch doesn't replace the existing way of displaying categories. Rather, it provides an option--to designate specific vocabularies to display instead in a list form. This functionality would help to take fuller advantage of the powerful and flexible taxonomy system.
Comment #2
dries commentedMaybe provide some screenshots to illustrate the proposed changes/additions?
Comment #3
Bèr Kessels commentedBump. This still lloks interesting but is old and does no longer apply. Should it be updated or closed?
Comment #4
killes@www.drop.org commentedThe patch does not apply anymore.
I also disagree with adding a setting for this. IMHO, the terms should always be retrieved sorted per vocab and the theme should decide how to present them.
Comment #5
nedjoThanks for the suggestion, killes, leaving presentation to themes does sound good. To do so, we could pass to the, e.g., theme_taxononomy_links() function an array of vocabulary objects (the vocabularies with matching terms), each with its own array of term objects (having $term->tid and $term->name properties). Does this sound like a good approach?
The only potential disadvantage I see in this approach versus the one I outlined is that it wouldn't enable distinct behaviours for different vocabularies (some display as undifferenciated links, others as inline lists sorted by vocabulary), but this functionality isn't essential.
Comment #6
nedjoI'm working on a way of implementing this thorugh the taxonomy_context module.