General developer forum

How do you modify the contents of $OUTPUT->main_content();

Picture of Kai Miller
How do you modify the contents of $OUTPUT->main_content();

I've tried tracking this down but I'm not totally sure how to alter this. I have a child theme and won't edit the core. So I guess I need to know how to extend the renderers. While there is some documentation on this, it pretty much ends at the most basic level.

add this to config.php:

$THEME->rendererfactory = 'theme_overridden_renderer_factory';

then create a renderers.php file and do one of 2 things:

require_once('renderers/course_renderer.php'); // for example

require_once('renderers/core_renderer.php'); // another for good measure

or just write the classes out in the renderers file...

Then that's pretty much it for docs or tutorials. How do I find out what renderers are being used on a page? 

If it helps to know, I've been tasked to build things outside the scope of moodle, like a big header image with customized text fields on a course level, tags, etc. And since it looks like all layouts chunk the entire page content into $OUTPUT->main_content(); it is making it incredibly difficult to track down how I would inject custom content into any page.

Average of ratings: -