Needs review
Project:
Node Auto Term [NAT]
Version:
7.x-1.x-dev
Component:
Code
Priority:
Major
Category:
Feature request
Assigned:
Unassigned
Reporter:
Anonymous (not verified)
Created:
8 Mar 2011 at 17:45 UTC
Updated:
15 Apr 2018 at 20:56 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
michaellander commentedWhat if instead, a new field type was created called like "Node Parent Term" or "Parent Node Auto Term', or something that works essentially as the default taxonomy term works now. Then give the default taxonomy term it's functionality back as just a reference? Maybe I'm not thinking this through enough but it seems like it should work?
Comment #2
biwashingtonial commentedBump. There are legitimate use cases for NAT that this undocumented feature breaks completely. In fact, any application that uses terms' parent-child relationships as an independent variable from terms' NAT relationships is potentially broken. Is there a compelling reason why we're doing this?
It might be surprising and confusing for a user to find that tagging a node to a term will cause that node's NAT term to magically pop up as a child of the tagged term over in the Taxonomy console. So +1 to @michaellander's suggestion to make this opt-in on a field-by-field basis.
Meanwhile, for anyone else needing a quick and dirty way to disable the auto-parent behavior site-wide, here's a patch.
Comment #3
capellicThis patch is great for shutting off the hierarchical effect completely, but like @michaellander and @biwashingtonial say above, I'd love to be able to designate which taxonomy reference field defines the relationship.
Comment #4
capellicI had to take further action to get this to work for my situation. In my case, I have a node/term relationship for an "item" content type. On that form, I am able to related the item to other items.
1. Parent
2. Related
In the first case, I want the default behavior, but not in the second case. Not only that, but if selecting both, the code gets thrown into an endless loop. This is the perfect use case for why we need to be able to determine which field is used to determine the hierarchy, if any at all.
I put a temporary hack in the code for now which allows me to explicitly define this field name. Of course, this is best on a configuration form, but exactly where that should go I am not sure. But I think by me identifying where that check should go, I'm thinking that there should be a checkbox on the "manage field" form. A hook_form_alter might be what's required.
The code is below and you can clearly see where I have hacked the code:
Comment #5
brooke_heaton commentedThe crux of this issue is that _nat_get_term_hierarchies returns a non-configurable array of parent terms based on any term reference on a $node. I have created a patch that makes $hierarchy configurable via the UI - add a parent, add multiple parents, add no parents and remove $hierarchy from your nat configuration all together. This solution is flexible and accommodates most concerns above. Feedback is most welcome!
NOTE: I updated the module below to account for some issues I discovered in testing.
Comment #6
brooke_heaton commentedUpdated and refactored patch to allow for multiple vocabs per bundle and to change from checkboxes to select to prevent php integrity issues in taxonomy_term_hierarchy after taxonomy_term_save.
Comment #7
brooke_heaton commentedUpdated patch with correct comment number.