Taxonomy Term Reference Tree Widget
About this module
This module provides an expandable tree widget for the Taxonomy Term Reference field in Drupal 7. This widget is intended to serve as a replacement for Drupal's core Taxonomy Term Reference widget, which is a flat list of radio buttons or checkboxes and not necessarily fit for medium to large taxonomy trees.
This widget has the following features:
- Expand/minimize buttons
- Fully theme-able
- Filter and sort available options with a view (if views is installed)
- The ability to start with the tree either minimized or maximized
- For large trees, this widget now optionally keeps a list of selected items below the tree.
- You can use tokens to alter the widget label (good for adding icons, turning the options into links, etc).
This module now comes with a display formatter with the following features:
- Display taxonomy terms as a nested list by hierarchy.
- Displayed terms can be altered with tokens or themed using a custom theme function.
Future features include:
- Dynamic loading of the tree as it is expanded (for very large trees)
Note: I don't have time to implement this at the moment. If someone is willing to volunteer to do this, I'd appreciate it.
How to use this module
- Enable the Term Reference Tree module.
- Go to the Manage Fields tab of any fieldable entity (such as a content type, taxonomy term, or user.
- Add a new field with a type of Term Reference.
- In the widget select box, select Term reference tree.
Note that you can also change any Term Reference field to use the Term Reference Tree widget, by editing that field and selecting Term Reference Tree on that field's Widget Type tab.
If you want to filter by a view, make sure the view includes the taxonomy term ID, and that the items per page is set to unlimited, as the widget will only display the items from the first page of results.