Future major features

Element Library

 
 
Picture of Danny Wahl
Re: Element Library
Group DevelopersGroup Particularly helpful Moodlers
Thanks Tim for the fuller answer, and that was my understanding of the situation as it is smile But your answers seem to point to my case that a plugin should be able to modify output:
  • I don't wanna hack mod_forum, or fork and extend mod_forum2, how about a local plugin that extends a single class with share links...
  • I don't wanna upload a favicon to every theme we let users use- or add code for touch icons! how about a local plugin that modifies get_favicon() or standard_html_head()
  • Ditto.

I understand the way moodle works now- I guess the question is: should it change?

I agree that themes shouldn't be adding this type of functionality- but right now they're the only way to do it w/o changing core code.  I mean I guess I could create a dozen little themes that only contain renderers with a handful of methods that output a single "widget" each where I can then include those themes as a parent/grandparent of any other theme and gain the functionality as needed...

 
Average of ratings: -
Davo
Re: Element Library
Group DevelopersGroup Particularly helpful Moodlers

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).

 
Average of ratings: -