Skip to content

Instantly share code, notes, and snippets.

@robdecker
Last active November 11, 2020 01:13
Show Gist options
  • Save robdecker/9119104 to your computer and use it in GitHub Desktop.
Save robdecker/9119104 to your computer and use it in GitHub Desktop.
[Create custom breadcrumbs for views] #d7
/**
* Implements hook_views_pre_render().
*/
function HOOK_views_pre_render(&$view) {
if ($view->name == 'NAME') {
$breadcrumb = array();
$breadcrumb[] = l(t('Home'), '<front>');
$breadcrumb[] = l(drupal_get_title(), current_path());
drupal_set_breadcrumb($breadcrumb);
}
}
@brrih
Copy link

brrih commented May 20, 2016

Nice! The only possible issue I'm seeing is:

$breadcrumb[] = l(drupal_get_title(), current_path());

In that Drupal already appends the breadcrumb for the current page, so I've just nixed that line.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment