From 01dd0b86f856bf35f5ee84cb52c5e57fe00470cc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Niels=20Gandra=C3=9F?= Date: Wed, 27 Nov 2024 09:39:23 +0100 Subject: [PATCH] Fix rendering of choices: resolve pluginfile URLs and preserve HTML tags in `format_choices()`, allowing use of images and other HTML content --- renderer.php | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/renderer.php b/renderer.php index 32d3b28..68e5e2f 100644 --- a/renderer.php +++ b/renderer.php @@ -70,7 +70,14 @@ public function format_choices(question_attempt $qa) { $question = $qa->get_question(); $choices = array(); foreach ($question->get_choice_order() as $key => $choiceid) { - $choices[$key] = format_string($question->choices[$choiceid]);; + $choices[$key] = $question->format_text( + $question->choices[$choiceid], + FORMAT_MOODLE, + $qa, + 'qtype_ddmatch', + 'subanswer', + $choiceid + ); } return $choices; }