Skip to content

Commit

Permalink
MDL-65355 course: Render course search encoded characters correctly
Browse files Browse the repository at this point in the history
  • Loading branch information
rhell4 committed Dec 20, 2024
1 parent 7d6f282 commit 0dfa958
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions course/renderer.php
Original file line number Diff line number Diff line change
Expand Up @@ -2022,7 +2022,10 @@ public function get_course_formatted_summary($course, $options = array()) {
$summary = file_rewrite_pluginfile_urls($course->summary, 'pluginfile.php', $context->id, 'course', 'summary', null);
$summary = format_text($summary, $course->summaryformat, $options);
if (!empty($this->searchcriteria['search'])) {
$summary = highlight($this->searchcriteria['search'], $summary);
// The course summary we are highlighting is a formatted string,
// so the search term should also be a formatted string to match.
$search = format_string($this->searchcriteria['search'], true, $options);
$summary = highlight($search, $summary);
}
return $summary;
}
Expand All @@ -2041,7 +2044,10 @@ public function get_course_formatted_name($course, $options = array()) {
}
$name = format_string(get_course_display_name_for_list($course), true, $options);
if (!empty($this->searchcriteria['search'])) {
$name = highlight($this->searchcriteria['search'], $name);
// The course name we are highlighting is a formatted string,
// so the search term should also be a formatted string to match.
$search = format_string($this->searchcriteria['search'], true, $options);
$name = highlight($search, $name);
}
return $name;
}
Expand Down

0 comments on commit 0dfa958

Please sign in to comment.