Trails

Component ID

1566744

Component name

Trails

Component type

module

Maintenance status

Development status

Component security advisory coverage

not-covered

Downloads

1271

Component created

Component changed

Component body

Provides an alternative page trails management workflow for customizing the page breadcrumb trail. Trails can also be combined with Rules to add individual crumbs at various points in displaying a page.

Trails contains a separate breadcrumb-like API, except the individual crumbs in the trail are raw arrays instead of rendered links. This API can be used to influence the page trails in much the same way drupal_set_breadcrumb() affects the page breadcrumb. Note that the "Home" crumb is intentionally absent by default (for addition only immediately before rendering).

Because of the atomic nature of trails in this module, there are also facilities to add individual crumbs or partial trails to the currently applied trail. For example, in a site where content types have hierarchical relationships (section vs. collection vs. item), the collection could add the section as a crumb, and the item could add the collection as a crumb.

Trails itself can take care of setting the trail as breadcrumb before a page is rendered (i.e. in hook_preprocess_page()) given a configurable setting. Alternatively, Trails also implements a default (inactive) rule to set breadcrumb reacting on a provided event "Before rendering page", which also occurs at the same point in page display.

Trails also includes a utility to build a trail from a menu. What this means is that Trails is compatible with menu-related modules such as Menu Trail By Path.

Note regarding theme

If the default facility to set breadcrumb when preprocessing a page is used, the active theme must render the breadcrumb (i.e. theme('breadcrumb', drupal_get_breadcrumb())) in hook_preprocess_page() at the earliest.

Luckily, Drupal 7 core assumes this by default in rendering breadcrumb in template_process_page(), and many base themes either delegate breadcrumb rendering to Drupal or render in hook_preprocess_page() (e.g. Clean).