]> git.mjollnir.org Git - moodle.git/commit
themes: MDL-19077 implement the renderer_factory instrastructure.
authortjhunt <tjhunt>
Thu, 18 Jun 2009 10:43:13 +0000 (10:43 +0000)
committertjhunt <tjhunt>
Thu, 18 Jun 2009 10:43:13 +0000 (10:43 +0000)
commit571fa828248b82c1999bac27d1d763346bfcaef6
treea6d4fe9e627c604284a5d150b1d33d3edaa6cdde
parent78ff29832d41f5268d37ad07ad0c5371759003b9
themes: MDL-19077 implement the renderer_factory instrastructure.

This is part of http://docs.moodle.org/en/Development:Theme_engines_for_Moodle%3F

The concept is that all the print_... functions in weblib get replaced  by methods
on a moodle_core_renderer class. Then, the theme can choose whether to
use the standard moodle_core_renderer class, or another implemenatation of
its own choosing, to generate different HTML.

Also, becuase Moodle is modular, we may need a moodle_mod_forum_renderer
and so on.

In order for the theme to be able to choose which renderers get created, we
introduce the concept  of a renderer factory, as in the factory design pattern.
The theme will choose which factory should be used, and that then creates
the renderer objects based on the module name.

This commit includes 4 types of factory:
* standard_renderer_factory
* custom_corners_renderer_factory
* theme_overridden_renderer_factory
* template_renderer_factory

All this with unit tests and PHP doc comments.

Note, this new code is not actually used yet. Still todo:
1. actually define the moodle_core_renderer class, and deprecate a lot of weblib functions.
2. make theme_setup initialise everything, so it is used.
lib/outputlib.php [new file with mode: 0644]
lib/pagelib.php
lib/simpletest/testoutputlib.php [new file with mode: 0644]