I would like to build a custom breadcrumb based on node relation from entity reference. For example there is a book node that has menu hierarchy:
Book
|-chapter 1
|--sub chapter 1.1
|---sub sub chapter 1.1.1
|----#Node with different content type and not included/displayed on Book
Navigation
The Page Node (sub sub chapter 1.1.1) has entity reference relation with node biblio (for ex)
What I want is when I access biblio then the breadcrumb is displayed like the above tree.
Possible solution:
Write a code using nexus theme on template.php on function:
function nexus_breadcrumb($variables) {
//$breadcrumb = $variables['breadcrumb'];
//$node = $variables['node'];
if ($node->type == 'biblio'){
// pseudo code start
// get 'book' node that point to biblio
// get menu tree from the book node
// construct the menu tree and assign it to $breadcrumb
// this is I still not know how to code the section.
}
if (!empty($breadcrumb)) {
// Use CSS to hide titile .element-invisible.
$output = '<h2 class="element-invisible">' . t('You are here') . '</h2>';
// comment below line to hide current page to breadcrumb
$output .= '<nav class="breadcrumb">' . implode(' » ', $breadcrumb) .
'</nav>';
return $output;
}
}
Any help will do. Thank you.