diff --git a/course/format/upgrade.txt b/course/format/upgrade.txt
index 2481c554779..6451852ea17 100644
--- a/course/format/upgrade.txt
+++ b/course/format/upgrade.txt
@@ -2,6 +2,12 @@ This files describes API changes for course formats
Overview of this plugin type at http://docs.moodle.org/dev/Course_formats
+=== 2.6 ===
+
+* An additional course renderer function has been created which allows you to
+ specify the wrapper for a course module within a section (e.g. the
). This can be
+ found in core_course_renderer::course_section_cm_list_item().
+
=== 2.5 ===
* Functions responsible for output in course/lib.php are deprecated, the code is moved to
diff --git a/course/renderer.php b/course/renderer.php
index bfd8606134a..50aecbc32f9 100644
--- a/course/renderer.php
+++ b/course/renderer.php
@@ -820,6 +820,28 @@ class core_course_renderer extends plugin_renderer_base {
return '';
}
+ /**
+ * Renders HTML to display one course module for display within a section.
+ *
+ * This function calls:
+ * {@link core_course_renderer::course_section_cm()}
+ *
+ * @param stdClass $course
+ * @param completion_info $completioninfo
+ * @param cm_info $mod
+ * @param int|null $sectionreturn
+ * @param array $displayoptions
+ * @return String
+ */
+ public function course_section_cm_list_item($course, &$completioninfo, cm_info $mod, $sectionreturn, $displayoptions = array()) {
+ $output = '';
+ if ($modulehtml = $this->course_section_cm($course, $completioninfo, $mod, $sectionreturn, $displayoptions)) {
+ $modclasses = 'activity ' . $mod->modname . ' modtype_' . $mod->modname . ' ' . $mod->get_extra_classes();
+ $output .= html_writer::tag('li', $modulehtml, array('class' => $modclasses, 'id' => 'module-' . $mod->id));
+ }
+ return $output;
+ }
+
/**
* Renders HTML to display one course module in a course section
*
@@ -956,7 +978,7 @@ class core_course_renderer extends plugin_renderer_base {
continue;
}
- if ($modulehtml = $this->course_section_cm($course,
+ if ($modulehtml = $this->course_section_cm_list_item($course,
$completioninfo, $mod, $sectionreturn, $displayoptions)) {
$moduleshtml[$modnumber] = $modulehtml;
}
@@ -972,11 +994,7 @@ class core_course_renderer extends plugin_renderer_base {
array('class' => 'movehere', 'title' => $strmovefull));
}
- $mod = $modinfo->cms[$modnumber];
- $modclasses = 'activity '. $mod->modname. ' modtype_'.$mod->modname. ' '. $mod->get_extra_classes();
- $sectionoutput .= html_writer::start_tag('li', array('class' => $modclasses, 'id' => 'module-' . $mod->id));
$sectionoutput .= $modulehtml;
- $sectionoutput .= html_writer::end_tag('li');
}
if ($ismoving) {