-
Sub-task
-
Resolution: Won't Fix
-
Major
-
None
-
2.3.6, 2.4.3, 2.5
-
MOODLE_23_STABLE, MOODLE_24_STABLE, MOODLE_25_STABLE
-
At the moment, if a theme wants to override a renderer, it has be put that class inside theme/name/renderers.php.
The problem with this is that to override a renderer, you have to include the original renderer class definition, so you can subclass it.
And because renderers need to deal with the inner workings of the component they are for, component renderers often need to include lots of other class definitions.
and so including theme/name/renderers.php is very expensive performance wise. For example, it might load all the quiz code, even if we are not doing any quiz-related code.
So, we propose to change the logic. If the theme contains a directory renderers, containing files with names like mod_quiz_renderer.php or block_navigation_renderer.php or core_calendar_renderer.php, then we include those files, but only when required, and we don't include renderers.php.
(In this situation, we will just ignore renderers.php, if it exists. That way, people can make third-part themes with a renderers.php, which does require_once on all the files in the renderers folder, and there theme will work with both 2.4 and 2.5.)
If a theme does not have a renderers folder, and does have a renderers.php file, then we will require it as at present, for backwards compatibility.
- has a non-specific relationship to
-
MDL-39854 Automatic class loading
- Closed