Element Library

Re: Element Library

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

You can also create a local plugin that contains it's own renderer factory and then get all themes to use that.

e.g.

class local_mylocal_renderer_factory extends theme_overridden_renderer_factory {
    public function __construct(theme_config $theme) {
        parent::__construct($theme);
        array_unshift($this->prefixes, 'local_mylocal');
    }
}

Then in your theme config.php:

require_once($CFG->dirroot.'/local/mylocal/renderer.php');
$THEME->rendererfactory = 'local_mylocal_renderer_factory';


This will give your local plugin the final say on any renderers. With the major proviso that, for any renderer classes you create in your local plugin, any renderers overriding the same classes in your themes will be ignored (unless you subclass your local renderers from the theme renderers).