MDL-41809 course: do not rely on page context

page context may not be set, use the correct course context when calling format_string
This commit is contained in:
Marina Glancy
2017-03-23 14:46:05 +08:00
parent 6e0c45eab6
commit 3cd85bbfae
+2 -1
View File
@@ -1393,7 +1393,8 @@ class grade_item extends grade_object {
public function get_name($fulltotal=false) {
if (strval($this->itemname) !== '') {
// MDL-10557
return format_string($this->itemname);
$options = ['context' => context_course::instance($this->courseid)];
return format_string($this->itemname, true, $options);
} else if ($this->is_course_item()) {
return get_string('coursetotal', 'grades');