MDL-74160 core_coureformat: fix legacy renderer methods

To ensure legacy course formats works on Moodle 4.0 some method are
reintroduced (but marked as deprecated) like start_section_list and
end_section_list. Furthermore, the course_section_cm_availability
returns a string again as expected.
This commit is contained in:
Ferran Recio 2022-03-16 16:18:43 +01:00
parent 9344149aba
commit ce7edab8a8
3 changed files with 30 additions and 4 deletions

View File

@ -413,6 +413,34 @@ abstract class section_renderer extends core_course_renderer {
return $o;
}
/**
* Generate the starting container html for a list of sections.
*
* @deprecated since 4.0 MDL-72656 - use core_course output components instead.
*
* @return string HTML to output.
*/
protected function start_section_list() {
debugging('start_section_list() is deprecated. Please use ' .
'core_courseformat\\output\\local\\content\\section to render individual sections or .' .
'core_courseformat\\output\\local\\content to render the full course', DEBUG_DEVELOPER);
return html_writer::start_tag('ul', ['class' => 'sections']);
}
/**
* Generate the closing container html for a list of sections.
*
* @deprecated since 4.0 MDL-72656 - use core_course output components instead.y
*
* @return string HTML to output.
*/
protected function end_section_list() {
debugging('end_section_list() is deprecated. Please use ' .
'core_courseformat\\output\\local\\content\\section to render individual sections or .' .
'core_courseformat\\output\\local\\content to render the full course', DEBUG_DEVELOPER);
return html_writer::end_tag('ul');
}
/**
* Old method to print section edit controls. Do not use it!
*

View File

@ -823,10 +823,8 @@ class core_course_renderer extends plugin_renderer_base {
$mod->get_section_info(),
$mod,
);
$renderer = $format->get_renderer($this->page);
$data = $availability->export_for_template($renderer);
return $data->info ?? '';
return $renderer->render($availability);
}
/**

View File

@ -56,9 +56,9 @@ renderer and course format renderer:
- course_section_cm_name_title (replaced by core_courseformat\output\local\cm\title)
- course_section_cm_text (integrated in core_courseformat\output\local\content\cm)
- course_section_cm_availability (replaced by core_courseformat\output\local\content\cm\availability))
* The following abstract methods are deleted:
- start_section_list (integrated in core_courseformat\output\local\content)
- end_section_list (integrated in core_courseformat\output\local\content)
* The following abstract methods are deleted:
- page_title (moved to core_courseformat\output\local\content)
* Course formats should have a renderer (until now it was only highly recommended but not mandatory). For backwards
compatibility (to not break third-party plugins without it), legacy_format_renderer has been created and will be used when