From c45cb4bbd7e6ca4775c10e85508458fa5ce38fb6 Mon Sep 17 00:00:00 2001 From: tjhunt <tjhunt> Date: Sat, 18 Jul 2009 11:59:17 +0000 Subject: [PATCH] Improve comment. Thanks David Mudrak. --- lib/outputlib.php | 30 ++++++++++++++++++++---------- 1 file changed, 20 insertions(+), 10 deletions(-) diff --git a/lib/outputlib.php b/lib/outputlib.php index b60f4f7ad4..30626b8ed1 100644 --- a/lib/outputlib.php +++ b/lib/outputlib.php @@ -46,16 +46,26 @@ interface renderer_factory { /** * Return the renderer for a particular part of Moodle. * - * The renderer interfaces are defined by classes called moodle_..._renderer - * where ... is the name of the module, which, will be defined in this file - * for core parts of Moodle, and in a file called renderer.php for plugins. - * - * There is no separate interface definintion for renderers. Instead we - * take advantage of PHP being a dynamic languages. The renderer returned - * does not need to be a subclass of the moodle_..._renderer base class, it - * just needs to impmenent the same interface. This is sometimes called - * 'Duck typing'. For a tricky example, see {@link template_renderer} below. - * renderer ob + * The renderer interfaces are defined by classes called moodle_{plugin}_renderer + * where {plugin} is the name of the component. The renderers for core Moodle are + * defined in lib/renderer.php. For plugins, they will be defined in a file + * called renderer.php inside the plugin. + * + * Renderers will normally want to subclass the moodle_renderer_base class. + * (However, if you really know what you are doing, you don't have to do that.) + * + * There is no separate interface definintion for renderers. The default + * moodle_{plugin}_renderer implementation also serves to define the API for + * other implementations of the interface, whether or not they subclass it. + * For example, {@link custom_corners_core_renderer} does subclass + * {@link moodle_core_renderer}. On the other hand, if you are using + * {@link template_renderer_factory} then you always get back an instance + * of the {@link template_renderer} class, whatever type of renderer you ask + * for. This uses the fact that PHP is a dynamic language. + * + * A particular plugin can defnie multiple renderers if it wishes, using the + * $subtype parameter. For example moodle_mod_workshop_renderer, + * moodle_mod_workshop_allocation_manual_renderer etc. * * @param string $component name such as 'core', 'mod_forum' or 'qtype_multichoice'. * @param moodle_page $page the page the renderer is outputting content for. -- 2.39.5