Breadcrumb trail fix for taxonomy/term overrides
Last modified: April 30, 2009 - 02:21
When using a View to override taxonomy/term pages, the breadcrumb trail goes missing - only the Home page link remains. By adding the following code (excluding the php tags, of course) to the Argument Handling Code section of your View, the breadcrumb trail is brought back to life:
<?php
$current = taxonomy_get_term($args[0]);
$breadcrumbs = array(array('path' => $_GET['q'], 'title' => $current->name));
while ($parents = taxonomy_get_parents($current->tid)) {
$current = array_shift($parents);
$breadcrumbs[] = array('path' => 'taxonomy/term/'. $current->tid, 'title' => $current->name);
}
$breadcrumbs = array_reverse($breadcrumbs);
menu_set_location($breadcrumbs);
?>This was taken from a discussion here: http://drupal.org/node/114548#comment-912789. Several other solutions are also provided there, but this one seemed to be the cleanest solution.
