diff --git a/question/type/match/questiontype.php b/question/type/match/questiontype.php index 02840219b2e..dd57e31a45d 100644 --- a/question/type/match/questiontype.php +++ b/question/type/match/questiontype.php @@ -284,7 +284,7 @@ class question_match_qtype extends default_questiontype { if ($subquestion->questiontext !== '' && !is_null($subquestion->questiontext)) { // Subquestion text: $a = new stdClass; - $text = quiz_rewrite_question_urls($subquestion->questiontext, 'pluginfile.php', $context->id, 'qtype_match', 'subquestion', array($state->attempt, $state->question), $subquestion->id); + $text = $this->format_subquestion_text($subquestion, $state, $context); $a->text = $this->format_text($text, $subquestion->questiontextformat, $cmoptions); // Drop-down list: @@ -329,6 +329,19 @@ class question_match_qtype extends default_questiontype { include("$CFG->dirroot/question/type/match/display.html"); } + /** + * Prepare the text of a subquestion for output. + * @param object $subquestion + * @param object $state + * @param object $context + * @return string html fragment. + */ + function format_subquestion_text($subquestion, $state, $context) { + return quiz_rewrite_question_urls($subquestion->questiontext, 'pluginfile.php', + $context->id, 'qtype_match', 'subquestion', + array($state->attempt, $state->question), $subquestion->id); + } + function grade_responses(&$question, &$state, $cmoptions) { $subquestions = &$state->options->subquestions; $responses = &$state->responses; diff --git a/question/type/randomsamatch/questiontype.php b/question/type/randomsamatch/questiontype.php index 0bb2aa89648..0fe6565c6ee 100644 --- a/question/type/randomsamatch/questiontype.php +++ b/question/type/randomsamatch/questiontype.php @@ -334,6 +334,12 @@ class question_randomsamatch_qtype extends question_match_qtype { function get_random_guess_score($question) { return 1/$question->options->choose; } + + function format_subquestion_text($subquestion, $state, $context) { + return quiz_rewrite_question_urls($subquestion->questiontext, 'pluginfile.php', + $context->id, 'question', 'questiontext', + array($state->attempt, $state->question), $subquestion->id); + } } //// END OF CLASS ////