Merge branch 'MDL-81397-404' of https://github.com/paulholden/moodle into MOODLE_404_STABLE

This commit is contained in:
Huong Nguyen
2024-06-06 22:06:26 +08:00
committed by Jun Pataleta
@@ -26,6 +26,7 @@ use coding_exception;
use core_course_renderer;
use core_courseformat\base as course_format;
use html_writer;
use moodle_page;
use renderable;
use section_info;
use stdClass;
@@ -39,6 +40,23 @@ use stdClass;
*/
abstract class section_renderer extends core_course_renderer {
/**
* Constructor method, calls the parent constructor.
*
* @param moodle_page $page
* @param string $target one of rendering target constants
*/
public function __construct(moodle_page $page, $target) {
parent::__construct($page, $target);
// Ensure capabilities for section editing controls match those defined in course/view.php to ensure that they work
// when called via an AJAX request.
if (course_get_format($page->course)->uses_sections()) {
$page->set_other_editing_capability('moodle/course:sectionvisibility');
$page->set_other_editing_capability('moodle/course:movesections');
}
}
/**
* Renders the provided widget and returns the HTML to display it.
*