How to override navigationlib.php functions ?

How to override navigationlib.php functions ?

by Javier Cuadrado -
Number of replies: 2

Hi !

I'm trying to override this function in a child theme of boost (moodle 3.11).

lib/navigationlib.php
public function get_items() 

I thought it should work following the same method as for the outputrenderers.
I've pasted the function here but it does not work...

theme/mytheme/renderers.php
class theme_mytheme_core_renderer extends core_renderer {
   public function get_items() 

I have tried to look for any tuto about this but have not found anything.

Do you have any advice ?

Thanks !
Javier
Average of ratings: -
In reply to Javier Cuadrado

Re: How to override navigationlib.php functions ?

by Mark Johnson -
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers

Hi Javier, Unfortunately, it's not possible to override general functions and methods this way. Renderers and templates are called in such a way that they can be overriden by a theme, but other parts of the code are not. What exactly is it you're trying to change about the behaviour of get_items()? Someone may be able to suggest another way to achieve your goal.

In reply to Mark Johnson

Re: How to override navigationlib.php functions ?

by Javier Cuadrado -
Hi Mark, thanks for your answer !

I would like to change the logic of the breadcrumbs. 
I finally managed to change this by duplicating and modifying the template directly in my theme
theme/mytheme/templates/core/navbar.mustache

Average of ratings: Useful (1)