Theme Boost Campus generates white page by overriding mod renderer

Theme Boost Campus generates white page by overriding mod renderer

by Jürgen Buchberger -
Number of replies: 3

Hi there,

installed Moodle 3.7 with theme Boost Campus. All css adjustments are working fine as expected, but today i run into trouble with theme overrides for mod_quiz. After checking if I have some code syntax errors I generated only for testing purposes empty renderers. And I found out that a override for core_renderer

<?php
 
class theme_boost_campus_core_renderer extends core_renderer {

}

generates no error and everything is working fine. But if I try to override modules

<?php
 
class theme_boost_campus_mod_quiz_renderer extends mod_quiz_renderer {
 
}

or

<?php
 
class theme_boost_campus_mod_glossary_renderer extends mod_glossary_renderer {

 
}

moodle crashes with a white page and a server error 500.

Btw, it doesn't matter if the mod override contains code or not, it doesn't work. The override for the core is everytime (empty and with code) accepted and doesn't crash the system.

Any idea? Any hints?

Best regards,
Jürgen


Average of ratings: -
In reply to Jürgen Buchberger

Re: Theme Boost Campus generates white page by overriding mod renderer

by Tim Hunt -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers
If you are getting a white screen, then that is probably an error.

Make sure you have Debugging turned on while you are doing development.
In reply to Tim Hunt

Re: Theme Boost Campus generates white page by overriding mod renderer

by Jürgen Buchberger -
Enabling debugging was the first I did, but the result was irritating:

Fatal error: Class 'mod_quiz_renderer' not found in /html/elearning/kurse/theme/boost_campus/renderers.php on line 3

After searching for hours, I find the simple solution in a 18 month old post. By adding:
<?php

defined('MOODLE_INTERNAL') || die;

include_once($CFG->dirroot . "/mod/quiz/renderer.php");

class theme_boost_campus_mod_quiz_renderer extends mod_quiz_renderer {

}

In the documentation there is no instruction, that the renderer has to be included before overriding it.

Best regards,
Jürgen
In reply to Jürgen Buchberger

Re: Theme Boost Campus generates white page by overriding mod renderer

by Alexander Bias -
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers
Hi Jürgen,

I am one of the maintainers of Theme Boost Campus.

As far as I see, you are trying to extend / modify Boost Campus to change something in mod_quiz. I conclude this as Boost Campus currently does not have any overridden renderers for mod_quiz.

However, if you encounter any problems with Boost Campus (and specifically to Boost Campus and not to Boost), please raise an issue for us on https://github.com/moodleuulm/moodle-theme_boost_campus/issues.

Cheers,
Alex