Overriding a new course output class

Overriding a new course output class

by Tom Cripps -
Number of replies: 3

Hi all, i'm wondering if anyone can help me. I'm trying to achieve something in my Boost child theme on Moodle 4 that I have already had working on 3.11, but have come up against the re-worked course rendering system.

I'm using Moodle 4.0beta+ (Build: 20220329) and working with a brand new Boost child theme with zero customisation currently.

In our 3.11 Boost child theme we'd overridden the core course renderer to display some content next to a module title in a course - this all worked correctly, but now I need to do the same for our Moodle 4 theme I'm having trouble.

I've overridden the template (core_courseformat/local/content/cm/title) so now I need to add the logic somewhere and feed that template with the data it needs. I've located the core output class I need to override (course/format/classes/output/local/content/cm/title.php) but I'm unsure how to override it - or even if that's what I'm supposed to do with the output classes, from the information in the Moodle 4 developer information I think I'm on the right track.

If someone can point me in the right direction that would be excellent, I can't see a lot of discussion about this around yet as it's so new, so anything anyone can add would be great!

Tom

Average of ratings: -
In reply to Tom Cripps

Re: Overriding a new course output class

by Gareth J Barnard -
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Plugin developers
Hi Tom,

I'm still trying to get my head around the changes! I think it all depends on how the autoloading mechanism finds the overridden class in relation to core -> course format override -> theme override. One source of information is MDL-73679.

If you find a solution, then please do kindly share.

Kind regards,

Gareth
In reply to Gareth J Barnard

Re: Overriding a new course output class

by Tom Cripps -
Thanks Gareth, I've had a few days away from Moodle but I'll be sure to post back here when I've worked it out - I'm sure I will eventually!

Tom
In reply to Tom Cripps

Re: Overriding a new course output class

by Julius Saputra -
Hi guys

I just updated our instance and now also have the same problem for the template overriding inside the theme plugin.
Is there any update for this?

Many thanks in advance
Julius