From 3cd85bbfae80ecdd3d73f861c2ebe1067764c333 Mon Sep 17 00:00:00 2001 From: Marina Glancy Date: Thu, 23 Mar 2017 14:41:47 +0800 Subject: [PATCH] MDL-41809 course: do not rely on page context page context may not be set, use the correct course context when calling format_string --- lib/grade/grade_item.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/grade/grade_item.php b/lib/grade/grade_item.php index e373782795c..8fe5419e13c 100644 --- a/lib/grade/grade_item.php +++ b/lib/grade/grade_item.php @@ -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');