Breadcrumbs

Breadcrumbs

by Douglas Rosa -
Number of replies: 2

Hello everyone,

I need to change the default breadcrumb node and I don't know how to do it. When a node has no link, I want to have it in a span tag with no-link class (<span class='no-link'>). So I can style it with CSS:


Actually, in the code, it is just a text inside a <li>.

Can anyone help me?

Thanks!


Average of ratings: -
In reply to Douglas Rosa

Re: Breadcrumbs

by Conn Warwicker -
Picture of Core developers Picture of Plugin developers
I could be wrong, but I cannot see a way to easily do that without changing core code. It looks like the navigation nodes are built up in:
/lib/outputrenderers.php:render_navigation_node()

You can see in that method how it does it:

$attributes = array('tabindex'=>'0'); //add tab support to span but still maintain character stream sequence.
if ($title !== '') {
$attributes['title'] = $title;
}
if ($item->hidden) {
$attributes['class'] = 'dimmed_text';
}
$content = html_writer::tag('span', $content, $attributes);

So one option is to change that core method.

Another is to do it with javascript on page load, to add the class to any navigation nodes without hyperlinks.

I am not sure if it is possible to override that `render_navigation_node` method in your own class in the theme. It may be, but you would need to explore the code more thoroughly to see if it's possible.
Average of ratings: Useful (2)
In reply to Conn Warwicker

Re: Breadcrumbs

by Douglas Rosa -
Hey Conn, thanks for your hint, because of it I was able to find where I could fix it the way I wanted. I was searching for "breadcrumbs" in the code only, and I forgot that its the navbar also.

There is a file template (navbar.mustache) inside the templates/core folder that allow us to change it. Thank you!