Skip to content

Instantly share code, notes, and snippets.

@martsie
Created January 25, 2017 10:49
Show Gist options
  • Save martsie/c3212ad7fda42f7fdd369bbfb7ec50fa to your computer and use it in GitHub Desktop.
Save martsie/c3212ad7fda42f7fdd369bbfb7ec50fa to your computer and use it in GitHub Desktop.
Overriding breadcrumbs in Drupal 7
<?php
function my_awesome_theme_breadcrumb($variables) {
$breadcrumb = $variables['breadcrumb'];
if (!empty($breadcrumb)) {
// Provide a navigational heading to give context for breadcrumb links to
// screen-reader users. Make the heading invisible with .element-invisible.
$output = '<h2 class="element-invisible">' . t('You are here') . '</h2>';
// Add 'my-awesome-class' to the breadcrumb wrapper and change the separators from '»' to '::'.
$output .= '<div class="breadcrumb my-awesome-class">' . implode(' :: ', $breadcrumb) . '</div>';
return $output;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment