Where is the breadcrumb trail generated?

Where is the breadcrumb trail generated?

by Richard Crawford -
Number of replies: 4

We're using Moodle 2.3.2.

For some reason, the breadcrumb trail that should be appearing on all sub-pages within a course is not showing up in some places. I've confirmed that this is not a problem with our theme, since it happens with each theme that I switch to. So I'm wondering where in Moodle's source code the breadcrumb trail is initiated; I think that once I track that down, I can fix this bug. 

See this thread for screenshots of what is happening in our site.

As always, help, insight, hints, thoughts, smoke signals, etc., would be greatly appreciated. I'd like to emphasize that this is a priority for us, because the lack of the breadcrumb trail makes it difficult to navigate throughout the course. 

Average of ratings: -
In reply to Richard Crawford

Re: Where is the breadcrumb trail generated?

by Tim Hunt -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers

What happens is that there is a backend class, called something like core_navigation, which builds the underlying navigation structure. (In an MVC pucture, it is the Model). You can get at it via $PAGE->nav

Then there are various view of that, including block_navigation and the breadcrumbs bar. I think the breadcrumbs are something like $PAGE->navbar.

Sorry, I am writing this off the top of my head without looking at the code, but the places to look are lib/navigationlib.php and lib/pagelib.php.

In reply to Tim Hunt

Re: Where is the breadcrumb trail generated?

by Richard Crawford -

Thanks for the reply, Tim, I appreciate it. smile

I found the code I was looking for in lib/navigationlib.php. 

In reply to Richard Crawford

Re: Where is the breadcrumb trail generated?

by Danny Wahl -

it could still be the theme (or parent theme or all themes) IF the config for the page-layout for that page has nonavbar=>true

In reply to Danny Wahl

Re: Where is the breadcrumb trail generated?

by Richard Crawford -

Thanks for the reply, Danny. I appreciate your time.

Turned out to be some extraneous code in lib/navigationlib.php which we had inserted ourselves. However, it didn't have our standard "// LOCAL HACK" comment, so it took us some time to find it.