Taxonomy hide currently works by removing data from a node's taxonomy through hook_nodeapi(). Thus, the data becomes unavailable to modules and themes that may depend on it, causing issues such as #266885: Taxonomy is also hidden from Contemplate and #224287: Taxonomy Hide and Taxonomy Image.
A better approach would be to implement hook_preprocess_node() and simply replace the 'terms' variable.
| Comment | File | Size | Author |
|---|---|---|---|
| #8 | taxonomy_hide-link-alter-308133-8.patch | 6.34 KB | david lesieur |
Comments
Comment #1
brmassa commentedDavid,
i like it very much. As soon i get some time, i will submit such feature. thanks.
Can you create a patch?
regards,
massa
Comment #2
david lesieur commentedI'd love to code it but won't be able to get to it anytime soon, so I've posted this either for anyone interested, or as a reminder for myself. ;-)
Comment #3
adaven commentedI've found the simplest method is to use hook_link_alter, since you don't have to worry about deleting variables in hook_preprocess_node() that some other module might be relying on.
This example re-uses some of the code from _taxonomy_hide_nodeapi. Sorting will take a little more work thought,
Comment #4
brmassa commentedAdam,
nice! i will take a better look soon.
regards,
massa
Comment #5
smacphail commentedSubscribing.
I have a site I'm working where I'm using one vocabulary to organize content into the sections it belongs to, and a separate vocabulary to provide author-entered content tags. The second vocabulary is what I'd like to show, and the first vocabulary I'd like to hide, but still have access to in the node object so I can use it's values elsewhere.
Cheers!
Comment #6
david lesieur commentedComment #7
pianory commentedAgreed, this is a troublesome issue (just spent 20 man-hours between 5 people trying to find the issue, then found it was taxonomy_hide). Taxonomy_hide worked for hiding taxonomies on view, but when Acquia Search re-indexed, most of our taxonomies were suddenly hidden.
So, a way to non-invasively hide the taxonomy ID's would be ideal. Since taxonomy_hide does more than hide, would it be possible to list this on the frontpage of the module download to try to save other people from a 20 man-hour hunt? I imagine this module can be very useful, but in complex configurations, it can really cause some issues.
Perhaps internally we can get around to coding a patch that will work, since it seems like we'll need this functionality.
Thanks all for your contributions to this project! You guys rock!
Comment #8
david lesieur commentedAs adaven has mentioned in #3, the sorting is more work.
Here's a full patch with both the hiding and the sorting, but I have not tested it much. Anyone interested in performing exhaustive tests? The tests should involve vocabularies and terms with various weights as well as nodes with node links other than just taxonomy links.
Comment #9
david lesieur commentedMarked #827696: Taxonomy Hide & Apache SOLR Search Integration as duplicate.
Comment #10
adam_b commentedsubscribe...
Comment #11
david lesieur commentedNote that I have positively tested the hiding part of my patch. It's the grouping and sorting part that I have not tested much. Help would be welcome.