The current breadcrumb only shows 'home'. I would like to update it so it shows 'home>shoes>Tennis Shoe' where 'shoes' is referenced content type(product display) and 'Tennis shoes' the instance(node) title of that content type
Here is how i tried to accomplish this.
I would push additional items(shoes, tennis shoe) into vars[breadcrumb] at page level(theme_preprocess_page) as following:
function THEME_preprocess_page(&$vars, $hook) {
...
$vars['breadcrumb'][] = '<a href="/shoes">shoes<a>';
$vars['breadcrumb'][] = '<a href="/shoes/tennis-shoe">Tennis Shoe<a>';
...
}
And then let my theme_breadcrumb() handle it as it walks through the array:
function THEME_breadcrumb($variables) {
$breadcrumb = $variables['breadcrumb'];
if (!empty($breadcrumb)) {
$breadcrumbs = '<ul class="breadcrumb">';
$count = count($breadcrumb) - 1;
foreach ($breadcrumb as $key => $value) {
if ($count != $key) {
$breadcrumbs .= '<li>' . $value . '<span class="divider">/</span></li>';
}
else{
$breadcrumbs .= '<li>' . $value . '</li>';
}
}
$breadcrumbs .= '</ul>';
return $breadcrumbs;
}
}
This doesn't work. Whenever I add the items to the vars['breadcrumb'] in the preprocessor function as showed above, it never goes to 'THEME_breadcrumb', instead displays 'array' text. (apparently, it expects non array at vars['breadcrumb']) How do you manipulate breadcrumbs? Whats wrong with my reasoning? Thank You
Drupal 7, base of boostrap theme