Last updated September 30, 2012. Created by Dmitriy.trt on May 27, 2012.
Log in to edit this page.

Taxonomy Menu Trails (TMT) module fixes the problem of collapsed categories menu on the node page when node itself is not in the menu. It was developed as a companion for Taxonomy Menu module, but they are independent from each other and TMT can be used separately.

Documentation below is for the last stable version in 7.x-2.x branch of the module. See separate page for 6.x version.

How it works

  • First, the module needs a node. Usually it works on the full node page (but it's not the only use case, see option "Additional path patterns for node detection" below).
  • Taxonomy terms are collected from taxonomy reference fields of the node. The module keeps the order of fields and terms inside them. Please, don't confuse the order of fields with the display order.
  • Paths are generated for each taxonomy term according to the settings described below. Default path is taxonomy/term/[tid].
  • Module searches for these paths in the menu and selects the most appropriate menu item (first, last or deepest) from the most preferable menu or from all menus (depends on options, see below).
  • This item is set as the deepest selected menu item in active trail.
  • Benefit! Menu is expanded to display selected menu item.
  • (optional) The breadcrumb is adjusted using this new active trail.

Installation and configuration

Installation is simple:

  • Download compatible module version for your Drupal core. See the project page for compatibility table.
  • Unpack
  • Enable

The module should be configured for each node type you want to expand the menu. First of all, attach at least one Term Reference field to the node type if you haven't done it before. There is a vertical tab named "Taxonomy Menu Trails" on the node type settings page with the following options:

Term references for setting active trail
Here you should select term reference fields that are used to get terms. You have to select at least one field for module to work.
Term selection method
This option defines how the module chooses the menu item for the active trail:
  • First/Last - select first/last term with menu item.
  • Deepest in menu - use the term with the deepest menu item.

Again, the order of fields and then the order of terms in these fields is used for the "First/Last" method.

Allow only terms with the current language
(Option available if Taxonomy translation module from the Internationalization project is enabled) When option is enabled, the module checks the language of taxonomy terms and allows only terms that are localized into current content language.
Only if node doesn't have enabled menu item
When enabled the module will check if current node itself has a menu item and won't do anything for such nodes. This is useful, for example, when you have a catalog menu tree, which should be expanded on usual products, but some featured products have their own menu items and you want to expand the menu with featured products rather than the catalog menu.
Separate active trail for each menu
Makes it possible to expand multiple menus when enabled. Otherwise only one trail in the most preferred menu will be active.
Add active trail to the breadcrumb
Menu items from the modified active trail will be inserted to the beginning of default breadcrumb (right after the link to front page, if any) when this option is enabled and the menu item was chosen. The option "When breadcrumb is empty" is useful to avoid problems with other breadcrumb modules, because with "Always" selected you can get some unexpected breadcrumb with too much items in it. Breadcrumb is always set using active trail from the most preferred menu regardless of the option "Separate active trail for each menu".
Term path
The method of getting paths for taxonomy terms:
  • Default: use taxonomy/term/[tid]
  • Custom patterns: specify the list of simple patterns.
  • Ask modules using API: call hook_taxonomy_menu_trails_get_paths() implementations and get paths from them. Default path will be used for terms that has no paths returned by implementations.
  • Ask Taxonomy Menu: get paths that were used for taxonomy menu generation. Available only if Taxonomy Menu module is enabled.
Term path patterns
Here you can specify simple path patterns. Tokens are not available here, the only placeholder available is [tid]. For complex path patterns you should use API instead of patterns. Be sure to add default pattern taxonomy/term/[tid] if you need it, because it is not included by default. The order of patterns is important for term selection method "First/Last", so be sure to move the most preferred pattern to the top line of the text area.
Additional path patterns for node detection
This option is for quite rare use cases and is useless for most of websites. By default the module is trying to detect node at node/[nid] and node/[nid]/*. Here you can specify additional paths to detect node and set menu trail for it. Each additional pattern will be tested on each page load, so use it only if you really need this feature.

Looking for support? Visit the Drupal.org forums, or join #drupal-support in IRC.