Using TVI to refine your term displays
The TVI module is made for people who want more control over the way views work with taxonomy terms. As you may know, you can create one or more views that output your term content however you are limited in how you may apply views to terms as a result of how the taxonomy module manages it's page callbacks. You can have a view on 'taxonomy/term/*' or 'taxonomy/term/[n]'... But how do make a view for one taxonomy vocabulary? TVI solves this problem.
TVI was written to allow selective overrides on vocabulary and terms with the view of your choice. TVI does not step on the toes of taxonomy or views that output to 'taxonomy/term/*' pages. If there are no TVI enabled view for the term or vocab currently being viewed, TVI passes the page request to the non-TVI view used for this callback. Or in the case that there is no view defined to handle the callback, TVI passes the request to taxonomy.
How do I use it?
- Download and install the TVI module (requires taxonomy and views)
- Determine what view you want to apply to a given vocabulary or term. This can be an existing view, you can create a new view, or you can clone the built-in Views 2 taxonomy/term/* view. If you do the latter, it's recommended you remove the "Page" display so as not to conflict with the core path, and use the "Defaults" display in the last step.
- Navigate to the taxonomy administration page at admin/content/taxonomy. You can override the general taxonomy view on an entire vocabulary or for a particular term. To apply a view to a vocabulary, click "edit vocabulary"; to apply a view to a single term, list the terms and then click "edit."
- A "view usage" section will be visible toward the bottom of the vocabulary or term edit page. Select the view you want to be applied, the display you wish to use, and then check "Use view override" to apply TVI.
As of Beta4, there are 2 theme functions included in TVI: theme_tvi_breadcrumb() and theme_tvi_title().
Things to note
- TVI cannot currently deal with multiple term displays. ex. taxonomy/term/4+6+7 and will pass these requests to non-TVI views if they exist, or taxonomy if all else fails.
- TVI does not care what your view does however TVI will pass the term id and term id with depth modifier to the view as arguments. To make use of these, simply add the following arguments to the view you plan to use on your term or vocabulary:
- A1: Taxonomy: Term ID (with depth)
- A2: Taxonomy: Term ID depth modifier
- TVI has an order of precedence mechanism:
- TVI term view override
- TVI vocabulary view override
- view path: taxonomy/term/tid(s) (exact match) +
- view path: taxonomy/term/* +
- taxonomy: taxonomy/term/tid(s) ++
- You may clone the default taxonomy/term/* view to create your TVI views as their arguments are identical. However, it is a good idea to give all TVI views that provide page displays a path other than the default taxonomy/term/*. Alternatively, you may remove the page displays and simply use the default or block view for TVI views: this is recommended.
- TVI uses hook_menu_alter to replace the taxonomy/term/* callback. Since it usurps the callback request, page titles and breadcrumbs must be generated internally to TVI. TVI gets this information from data found in the View being used, as well as drupal_get_breadcrumb().
+ If there are no views specified to be used on the viewed term or vocabulary, TVI will seek to find a view defined for the requested path.
++ In the case that TVI finds no views (TVI active or otherwise) for this term display, TVI will pass the buck to taxonomy for the regular display.