Drupal 7:
function THEMENAME_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>';
$crumbs = '<ul class="breadcrumbs clearfix">';
$array_size = count($breadcrumb);
$i = 0;
while ( $i < $array_size) {
$crumbs .= '<li class="breadcrumb-' . $i;
if ($i == 0) {
$crumbs .= ' first';
}
if($i != 0 && $i+1 != $array_size ) {
$crumbs .= ' middle';
}
if ($i+1 == $array_size) {
$crumbs .= ' last';
}
$crumbs .= '">' . $breadcrumb[$i] . '</li>';
$i++;
}
$crumbs .= '</ul>';
return $crumbs;
}
}
This outputs the breadcrumbs in the format I need other than I need to add span tags around the text inside the link.
The link is being written in the seventh line from the bottom:
$crumbs .= '">' . $breadcrumb[$i] . '</li>';
Any ideas?
Since I can’t see the content inside of
$breadcrumb[$i]I can’t be completely sure that this will work, but the following code should work for you as it wraps anything inside an anchor tag with a span tag:Just replace the seventh line in your function with these 2 lines and see if it works! Otherwise, use
var_dumpon$breadcrumb[$i]and add the result to your question.