MDL-65151 core_course: Final deprecation of section_edit_controls()

This commit is contained in:
Amaia Anabitarte 2019-06-04 17:09:52 +02:00
parent 5dae8c0515
commit 77e4d6f13b
3 changed files with 10 additions and 33 deletions

View File

@ -254,39 +254,11 @@ abstract class format_section_renderer_base extends plugin_renderer_base {
}
/**
* Generate the edit controls of a section
*
* @param stdClass $course The course entry from DB
* @param stdClass $section The course_section entry from DB
* @param bool $onsectionpage true if being printed on a section page
* @return array of links with edit controls
* @deprecated since Moodle 3.0 MDL-48947 - please do not use this function any more.
* @see format_section_renderer_base::section_edit_control_items()
* @deprecated since Moodle 3.0 MDL-48947 - Use format_section_renderer_base::section_edit_control_items() instead
*/
protected function section_edit_controls($course, $section, $onsectionpage = false) {
global $PAGE;
if (!$PAGE->user_is_editing()) {
return array();
}
$controls = array();
$items = $this->section_edit_control_items($course, $section, $onsectionpage);
foreach ($items as $key => $item) {
$url = empty($item['url']) ? '' : $item['url'];
$icon = empty($item['icon']) ? '' : $item['icon'];
$name = empty($item['name']) ? '' : $item['name'];
$attr = empty($item['attr']) ? '' : $item['attr'];
$class = empty($item['pixattr']['class']) ? '' : $item['pixattr']['class'];
$alt = empty($item['pixattr']['alt']) ? '' : $item['pixattr']['alt'];
$controls[$key] = html_writer::link(
new moodle_url($url), $this->output->pix_icon($icon, $alt),
$attr);
}
debugging('section_edit_controls() is deprecated, please use section_edit_control_items() instead.', DEBUG_DEVELOPER);
return $controls;
protected function section_edit_controls() {
throw new coding_exception('section_edit_controls() can not be used anymore. Please use ' .
'section_edit_control_items() instead.');
}
/**

View File

@ -44,7 +44,7 @@ class format_topics_renderer extends format_section_renderer_base {
public function __construct(moodle_page $page, $target) {
parent::__construct($page, $target);
// Since format_topics_renderer::section_edit_controls() only displays the 'Set current section' control when editing mode is on
// Since format_topics_renderer::section_edit_control_items() only displays the 'Highlight' control when editing mode is on
// we need to be sure that the link 'Turn editing mode on' is available for a user who does not have any other managing capability.
$page->set_other_editing_capability('moodle/course:setcurrentsection');
}

View File

@ -2,6 +2,11 @@ This files describes API changes for course formats
Overview of this plugin type at http://docs.moodle.org/dev/Course_formats
=== 3.8 ===
* The following functions have been finally deprecated and can not be used anymore:
* section_edit_controls()
=== 3.6 ===
* New method validate_format_options() cleans the values of the course/section format options before inserting them
in the database. Course format options can now be set in tool_uploadcourse and validation of user-submitted data is important.