MDL-71863 core_courseformat: mode site renderer to autoload

This commit is contained in:
Ferran Recio
2021-06-29 11:52:48 +02:00
parent 176bf81cb1
commit 1c0abade3e
4 changed files with 39 additions and 22 deletions
@@ -0,0 +1,30 @@
<?php
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* Site topics renderer.
*
* Site course is not a real course format, but it requires a format renderer to use the output
* components.
*
* @copyright 2021 Ferran Recio <[email protected]>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
namespace core_courseformat\output;
class site_renderer extends section_renderer {
}
+2 -5
View File
@@ -25,6 +25,7 @@
defined('MOODLE_INTERNAL') || die;
use core_courseformat\base as course_format;
use core_courseformat\output\site_renderer;
/**
* Returns an instance of format class (extending course_format) for given course
@@ -122,11 +123,7 @@ class format_site extends course_format {
* @return renderer_base
*/
public function get_renderer(moodle_page $page) {
global $CFG;
if (!class_exists('format_site_renderer')) {
require_once($CFG->dirroot.'/course/format/renderer.php');
}
return new format_site_renderer($page, null);
return new site_renderer($page, null);
}
/**
+6 -17
View File
@@ -15,25 +15,14 @@
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* Base renderer for outputting course formats.
* Legacy course format renderer file.
*
* @package core
* This file exists only for legacy reasons. Most third party format
* plugins include this file to extend the course format renderer. Now all
* format renderers are located in core_courseformat\output and uses autoload.
*
* @package core_courseformat
* @copyright 2012 Dan Poltawski
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
* @since Moodle 2.3
*/
defined('MOODLE_INTERNAL') || die();
/**
* Site topics renderer.
*
* Site course is not a real course format, but it requires a format renderer to use the output
* components.
*
* @copyright 2020 Ferran Recio <[email protected]>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class format_site_renderer extends core_courseformat\output\section_renderer {
}
+1
View File
@@ -46,5 +46,6 @@ $renamedclasses = array(
'format_topics_renderer' => 'format_topics\\output\\renderer',
'format_section_renderer_base' => 'core_courseformat\\output\\section_renderer',
'format_singleactivity_renderer' => 'format_singleactivity\\output\\renderer',
'format_site_renderer' => 'core_courseformat\\output\\site_renderer',
'format_weeks_renderer' => 'format_weeks\\output\\renderer',
);