Taxonomy vocabularies terms with at most 1 parent term?
I'm using Taxonomy Man开发者_Go百科ager module to manage my Taxonomy vocabularies.
How can I restrict the parents of the items to 1 ? I don't want my customer being able to add more than 1 parent to a taxonomy term.
thanks
With core taxonomy that is not possible.
I would suggest you build a simple module that uses either the hook_taxonomy to catch the insert and re-act on that. It has, however, no validate method, so you are actually a little "too late" when disallowing on insert or update.
The other way, would be slightly harder and uses hook_form_alter to add your own _validate callback to the forms where your users insert the extra terms. You can run any validation code in that callback, to detect the depth and post a form_set_error if the depth is too deep.
精彩评论