diff --git a/lib/moodlelib.php b/lib/moodlelib.php index cfa01da9aab..67832d3814f 100644 --- a/lib/moodlelib.php +++ b/lib/moodlelib.php @@ -6821,14 +6821,20 @@ function normalize_component($component) { /** * List all core subsystems, this is especially useful for get_string() - * and output renderers. The relative location is not always included. + * and output renderers. + * + * The location is dirroot relative path, NULL means there is no special + * directory for this subsystem. + * + * Unfortunately no module may be named like any core subsystem because + * we are still lazy to use proper "mod_" prefix in get_string() and elsewhere. * * @return array of strings - name=>location */ function get_core_subsystems() { global $CFG; - static $info = null; + static $info = null; if (!$info) { $info = array( diff --git a/lib/outputfactories.php b/lib/outputfactories.php index aebe7a28ca7..0707a7aef70 100644 --- a/lib/outputfactories.php +++ b/lib/outputfactories.php @@ -106,9 +106,6 @@ abstract class renderer_factory_base implements renderer_factory { /** @var theme_config the theme we belong to. */ protected $theme; - /** @var hardcoded list of core subtypes and their locations, add more if ßneeded */ - protected $core_subtypes = array('webservice' => 'webservice'); - /** * Constructor. * @param theme_config $theme the theme we belong to. @@ -176,10 +173,11 @@ abstract class renderer_factory_base implements renderer_factory { } } else if (!empty($subtype)) { - if (!isset($this->core_subtypes[$subtype])) { + $coresubsystems = get_core_subsystems(); + if (!isset($coresubsystems[$subtype])) { throw new coding_exception('Invalid core subtype "' . $subtype . '" in renderer request'); } - $rendererfile = $CFG->dirroot . '/' . $this->core_subtypes[$subtype] . '/renderer.php'; + $rendererfile = $CFG->dirroot . '/' . $coresubsystems[$subtype] . '/renderer.php'; if (file_exists($rendererfile)) { include_once($rendererfile); }