can a plugin override renderers?

Re: can a plugin override renderers?

by Davo Smith -
Number of replies: 0
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers

The code I suggested still uses the theme's renderers, as well as the local plugin renderer.

If you look at the code, you will notice that it is based on theme_overridden_renderer_factory and the __construct function calls the parent version, so the theme's renderer will be tried as well.

The one issue would be for a renderer that is overridden in both the theme and the local plugin. For that to work as expected, the local version would have to inherit from the theme version of the renderer, not the core version.

e.g.

class local_MYLOCAL_core_renderer extends theme_MYTHEME_core_renderer {

NOT

class local_MYLOCAL_core_renderer extends core_renderer {

(Obviously this only works if you know exactly which theme you are overriding)