From e2327b5219137cfd42c390c6152814e7d83ce348 Mon Sep 17 00:00:00 2001 From: Paul Holden Date: Wed, 2 Jun 2021 20:55:20 +0100 Subject: [PATCH] MDL-71682 course: remove deprecated non-AJAX activity chooser call. The deprecated method to render the dropdown based activity chooser from 430746d3 was still being called, which produced debugging on the site when doing so. --- course/renderer.php | 51 ++++++++++++++++++--------------------------- 1 file changed, 20 insertions(+), 31 deletions(-) diff --git a/course/renderer.php b/course/renderer.php index fe1eaba7726..df331a02680 100644 --- a/course/renderer.php +++ b/course/renderer.php @@ -264,6 +264,8 @@ class core_course_renderer extends plugin_renderer_base { /** * Renders HTML for the menus to add activities and resources to the current course * + * Renders the ajax control (the link which when clicked produces the activity chooser modal). No noscript fallback. + * * @param stdClass $course * @param int $section relative section number (field course_sections.section) * @param int $sectionreturn The section to link back to @@ -272,41 +274,28 @@ class core_course_renderer extends plugin_renderer_base { * @return string */ function course_section_add_cm_control($course, $section, $sectionreturn = null, $displayoptions = array()) { - // The returned control HTML can be one of the following: - // - Only the non-ajax control (select menus of activities and resources) with a noscript fallback for non js clients. - // Please note that non-ajax control has been deprecated and it will be removed in the future. + $straddeither = get_string('addresourceoractivity'); - // - Only the ajax control (the link which when clicked produces the activity chooser modal). No noscript fallback. + $ajaxcontrol = html_writer::start_tag('div', array('class' => 'mdl-right')); + $ajaxcontrol .= html_writer::start_tag('div', array('class' => 'section-modchooser')); - $courseajaxenabled = course_ajax_enabled($course); + $icon = $this->output->pix_icon('t/add', ''); + $span = html_writer::tag('span', $straddeither, array('class' => 'section-modchooser-text')); - // Non ajax control is under deprecated, $rendernonajaxcontrol will be removed in later versions. - $rendernonajaxcontrol = !$courseajaxenabled || $course->id != $this->page->course->id; - if ($rendernonajaxcontrol) { - // The non-ajax control, which includes an entirely non-js (