Taxonomy drag and drop for only 2 levels I've created a vocabulary, I can add terms but I want to "configure" this taxonomy to add terms with only 2 levels.

I'm talking about the default table that show my vocabulary terms (drag and drop system). How can I make it set only a term and sub-terms (disable sub-sub-...-subterms)?

I've tested the select module but as long as I can add multiple hierarchic terms, the select module add them as well, so it's not the solution

Thank you all
The theme function theme_taxonomy_overview_terms() drives the taxonomy overview table you're describing. The Drupal API function drupal_add_tabledrag() has an 8th parameter $limit that specifies the maximum depth of hierarchy. If it's set to 1, it will do what you describe.

In your theme, you can override theme_taxonomy_overview_terms() so the $limit is to 1. In order to do this.


Copy theme_taxonomy_overview_terms() to your theme's template.php.
Rename the function to MYTHEME_taxonomy_overview_terms in your template.php.
Alter the line drupal_add_tabledrag('taxonomy', 'match', 'parent', 'term-parent', 'term-parent', 'term-id', FALSE); so that the 8th parameter is 1 (i.e. change it to drupal_add_tabledrag('taxonomy', 'match', 'parent', 'term-parent', 'term-parent', 'term-id', FALSE, 1); )
Flush your theme cache to pickup the updated taxonomy overview page.