diff --git a/blocks/myoverview/classes/output/courses_view.php b/blocks/myoverview/classes/output/courses_view.php index 198deb6ef50..31dc8c62813 100644 --- a/blocks/myoverview/classes/output/courses_view.php +++ b/blocks/myoverview/classes/output/courses_view.php @@ -77,12 +77,12 @@ class courses_view implements renderable, templatable { $enddate = $course->enddate; $courseid = $course->id; $context = \context_course::instance($courseid); - // Convert summary to plain text. - $course->summary = content_to_text($course->summary, false); $exporter = new course_summary_exporter($course, [ 'context' => $context ]); $exportedcourse = $exporter->export($output); + // Convert summary to plain text. + $exportedcourse->summary = content_to_text($exportedcourse->summary, $exportedcourse->summaryformat); if (isset($this->coursesprogress[$courseid])) { $coursecompleted = $this->coursesprogress[$courseid]['completed']; diff --git a/course/classes/external/course_summary_exporter.php b/course/classes/external/course_summary_exporter.php index 113a3c70a93..342296ea83d 100644 --- a/course/classes/external/course_summary_exporter.php +++ b/course/classes/external/course_summary_exporter.php @@ -65,6 +65,9 @@ class course_summary_exporter extends \core\external\exporter { 'type' => PARAM_RAW, 'null' => NULL_ALLOWED ), + 'summaryformat' => array( + 'type' => PARAM_INT, + ), 'startdate' => array( 'type' => PARAM_INT, ), @@ -74,6 +77,18 @@ class course_summary_exporter extends \core\external\exporter { ); } + /** + * Get the formatting parameters for the summary. + * + * @return array + */ + protected function get_format_parameters_for_summary() { + return [ + 'component' => 'course', + 'filearea' => 'summary', + ]; + } + public static function define_other_properties() { return array( 'fullnamedisplay' => array(