How to Override renderer : /course/classes/output/activity_navigation.php

How to Override renderer : /course/classes/output/activity_navigation.php

by Nicolas JOURDAIN -
Number of replies: 2

Hi there,

What I want to do

I created a new theme.

In this theme, I am trying to change the look of the activity navigation that you can find at the bottom of each activity.

I identified the renderer:

/course/classes/output/activity_navigation.php

I also identified the template:

/course/templates/activity_navigation.mustache


What I have done:

I copied/pasted and modified (only changed the css class) the renderer to:

/theme/ncmboost/output/classes/activity_navigation_renderer.php (see code)

I also copied and modified the template to:

/theme/ncmboost/templates/core_course/activity_navigation.mustache (see code)


Results:

Any changes in the template works.

ISSUE: The changes in the renderer don't work. It seems that my renderer hasn't override the original renderer. sad


Question:

How can I correctly override this specific renderer?


Thanks for your help.

Average of ratings: -
In reply to Nicolas JOURDAIN

Re: How to Override renderer : /course/classes/output/activity_navigation.php

by Jean-Roch Meurisse -
Picture of Core developers Picture of Plugin developers Picture of Testers

Hi Nicolas,

The problem is that activity_navigation class is not a renderer but a renderable!

You have to override core_course_renderer class that has the method render_activity_navigation 

Cheers

Average of ratings: Useful (1)
In reply to Jean-Roch Meurisse

Re: How to Override renderer : /course/classes/output/activity_navigation.php

by Nicolas JOURDAIN -

Hi Jean-Roch,


Thank you so much for your help. I was able to move forward.

Here what I did:

I created a new file: /classes/output/core/course_renderer.php (code)

In this file I override the function render_activity_navigation (as you mentioned).


Average of ratings: Useful (3)