3

The site I am building uses fields (plus a custom module) to provide a richer set of relationships between taxonomy terms than the built-in hierarchy allows.

I want to remove/disable the built-in hierarchy. What I mean is that when a user is creating or editing a term, I do not want them to see the "Relations" section, and when they are viewing a list of terms in a taxonomy, I want the drag-and-drop functionality to only work for ordering, not indenting.

I know I can do this with another module using hook_form_alter() or the like, but is there an easier and quicker way to "turn off" this functionality in Drupal 8? I have a vague memory of (maybe in an earlier Drupal, or somewhere else) being able to specify, when you create a taxonomy, if you want it to be hierarchical or not, but I cannot find such a thing here.

0

If the Relation input is not exposed in the Form Display, then you are going to need to use a hook_form_alter to hide the Relation input.

Also, note, that the drag and reorganize on the vocabulary overview will still support hierarchy. You'll need to alter that form as well to disable it.

0
0

UPDATE

You can also use Flat Taxonomy module, this will get rid off both the parent and the drag-n-drop. Also if you enable it for an existing vocabulary with terms with hierarchy, it will flatten the tree for you. Bare in mind that the panel "Relations" keeps showing since contains the "Weight" field. If you plan using this module check the opened issues #3115794 and #3012578 since you need does patches in order to work.

Original answer

You can use Taxonomy Max Depth module, even though it does not get rid off the "Relations" panel validates the input, and also prevents the drag-n-drop on the terms overview. For a better results in terms of UX you can also hide the panel using the hook_form_alter as mentioned (I don't know how to achieve the same for the drag-n-drop other than replacing the view).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.