Proyectos de Subversion Moodle

Rev

| Ultima modificación | Ver Log |

Rev Autor Línea Nro. Línea
1441 ariadna 1
<?php
2
// This file is part of Moodle - http://moodle.org/
3
//
4
// Moodle is free software: you can redistribute it and/or modify
5
// it under the terms of the GNU General Public License as published by
6
// the Free Software Foundation, either version 3 of the License, or
7
// (at your option) any later version.
8
//
9
// Moodle is distributed in the hope that it will be useful,
10
// but WITHOUT ANY WARRANTY; without even the implied warranty of
11
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12
// GNU General Public License for more details.
13
//
14
// You should have received a copy of the GNU General Public License
15
// along with Moodle.  If not, see <http://www.gnu.org/licenses/>.
16
 
17
namespace core\output\renderer_factory;
18
 
19
use moodle_page;
20
use core\output\renderer_base;
21
 
22
/**
23
 * A renderer factory is just responsible for creating an appropriate renderer
24
 * for any given part of Moodle.
25
 *
26
 * Which renderer factory to use is chose by the current theme, and an instance
27
 * if created automatically when the theme is set up.
28
 *
29
 * A renderer factory must also have a constructor that takes a theme_config object.
30
 * (See {@see renderer_factory_base::__construct} for an example.)
31
 *
32
 * @copyright 2009 Tim Hunt
33
 * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
34
 * @since Moodle 2.0
35
 * @package core
36
 * @category output
37
 */
38
interface renderer_factory_interface {
39
    /**
40
     * Return the renderer for a particular part of Moodle.
41
     *
42
     * The renderer interfaces are defined by classes called {plugin}_renderer
43
     * where {plugin} is the name of the component. The renderers for core Moodle are
44
     * defined in lib/renderer.php. For plugins, they will be defined in a file
45
     * called renderer.php inside the plugin.
46
     *
47
     * Renderers will normally want to subclass the renderer_base class.
48
     * (However, if you really know what you are doing, you don't have to do that.)
49
     *
50
     * There is no separate interface definition for renderers. The default
51
     * {plugin}_renderer implementation also serves to define the API for
52
     * other implementations of the interface, whether or not they subclass it.
53
     *
54
     * A particular plugin can define multiple renderers if it wishes, using the
55
     * $subtype parameter. For example workshop_renderer,
56
     * workshop_allocation_manual_renderer etc.
57
     *
58
     * @param moodle_page $page the page the renderer is outputting content for.
59
     * @param string $component name such as 'core', 'mod_forum' or 'qtype_multichoice'.
60
     * @param string $subtype optional subtype such as 'news' resulting to 'mod_forum_news'
61
     * @param string $target one of rendering target constants
62
     * @return renderer_base an object implementing the requested renderer interface.
63
     */
64
    public function get_renderer(moodle_page $page, $component, $subtype = null, $target = null);
65
}
66
 
67
// Alias this class to the old name.
68
// This file will be autoloaded by the legacyclasses autoload system.
69
// In future all uses of this class will be corrected and the legacy references will be removed.
70
class_alias(renderer_factory_interface::class, \renderer_factory::class);