From 22cebed5035ba81b3dcd9d41e5fc7dcb6b786f4f Mon Sep 17 00:00:00 2001 From: Tim Hunt Date: Thu, 24 Feb 2011 20:18:16 +0000 Subject: [PATCH] MDL-20636 Review and fix the format parameter to all calls to format_text. --- mod/quiz/editlib.php | 5 ++- question/editlib.php | 2 +- question/engine/simpletest/helpers.php | 5 +++ question/format.php | 10 ++---- question/format/xhtml/format.php | 8 ++--- question/type/gapselect/questionbase.php | 10 +++--- question/type/gapselect/questiontypebase.php | 2 +- question/type/gapselect/rendererbase.php | 2 +- question/type/match/question.php | 8 ++--- question/type/match/questiontype.php | 3 +- question/type/match/renderer.php | 6 ++-- .../match/simpletest/testquestiontype.php | 24 +++++++++++--- question/type/multichoice/question.php | 15 +++++---- question/type/multichoice/renderer.php | 13 +++++--- question/type/questionbase.php | 31 ++++++++++++------- question/type/questiontype.php | 2 +- question/type/rendererbase.php | 9 +++--- question/type/shortanswer/renderer.php | 4 +-- question/type/truefalse/questiontype.php | 2 ++ question/type/truefalse/renderer.php | 8 ++--- 20 files changed, 100 insertions(+), 69 deletions(-) diff --git a/mod/quiz/editlib.php b/mod/quiz/editlib.php index 7d1da3f1902..8fba64df023 100644 --- a/mod/quiz/editlib.php +++ b/mod/quiz/editlib.php @@ -1123,10 +1123,9 @@ class quiz_question_bank_view extends question_bank_view { echo '
' . $strcategory; echo ': '; - echo shorten_text(strip_tags(format_text($category->name, FORMAT_MOODLE, - $formatoptions, $this->course->id)), 60); + echo shorten_text(strip_tags(format_string($category->name)), 60); echo '
'; - echo shorten_text(strip_tags(format_text($category->info, FORMAT_MOODLE, + echo shorten_text(strip_tags(format_text($category->info, $category->infoformat, $formatoptions, $this->course->id)), 200); echo '
'; } diff --git a/question/editlib.php b/question/editlib.php index 4cc811ad19c..cae3f0e5a03 100644 --- a/question/editlib.php +++ b/question/editlib.php @@ -1220,7 +1220,7 @@ class question_bank_view { $formatoptions->noclean = true; $formatoptions->overflowdiv = true; echo '
'; - echo format_text($category->info, FORMAT_MOODLE, $formatoptions, $this->course->id); + echo format_text($category->info, $category->infoformat, $formatoptions, $this->course->id); echo "
\n"; } diff --git a/question/engine/simpletest/helpers.php b/question/engine/simpletest/helpers.php index 7e2b9c66880..c37fa75975c 100644 --- a/question/engine/simpletest/helpers.php +++ b/question/engine/simpletest/helpers.php @@ -113,6 +113,8 @@ class test_question_maker { $tf->rightanswer = true; $tf->truefeedback = 'This is the right answer.'; $tf->falsefeedback = 'This is the wrong answer.'; + $tf->truefeedbackformat = FORMAT_HTML; + $tf->falsefeedbackformat = FORMAT_HTML; $tf->trueanswerid = 13; $tf->falseanswerid = 14; @@ -193,10 +195,13 @@ class test_question_maker { self::set_standard_combined_feedback_fields($match); + // Using unset to get 1-based arrays. $match->stems = array('', 'Dog', 'Frog', 'Toad', 'Cat'); + $match->stemformat = array('', FORMAT_HTML, FORMAT_HTML, FORMAT_HTML, FORMAT_HTML); $match->choices = array('', 'Mammal', 'Amphibian', 'Insect'); $match->right = array('', 1, 2, 2, 1); unset($match->stems[0]); + unset($match->stemformat[0]); unset($match->choices[0]); unset($match->right[0]); diff --git a/question/format.php b/question/format.php index 655ae4c73f5..007ae0fa8e7 100644 --- a/question/format.php +++ b/question/format.php @@ -846,14 +846,8 @@ class qformat_default { global $DB; $formatoptions = new stdClass(); $formatoptions->noclean = true; - $formatoptions->para = false; - if (empty($question->questiontextformat)) { - $format = FORMAT_MOODLE; - } else { - $format = $question->questiontextformat; - } - $text = $question->questiontext; - return format_text(html_to_text($text, 0, false), $format, $formatoptions); + return html_to_text(format_text($question->questiontext, + $this->questiontextformat, $formatoptions), 0, false); } /** diff --git a/question/format/xhtml/format.php b/question/format/xhtml/format.php index 34da5404efd..95a4d0aed7a 100644 --- a/question/format/xhtml/format.php +++ b/question/format/xhtml/format.php @@ -67,11 +67,9 @@ function writequestion($question) { // add header $expout .= "

$question->name

\n"; - // format and add question text - $questiontext = $question->questiontext; - $format = $question->questiontextformat; - $formatted_text = format_text($questiontext, $format); - $expout .= "

$formatted_text

\n"; + // Format and add the question text + $expout .= '

' . format_text($question->questiontext, + $question->questiontextformat); . "

\n"; // selection depends on question type switch($question->qtype) { diff --git a/question/type/gapselect/questionbase.php b/question/type/gapselect/questionbase.php index 13c5d48ec77..dee663b33b5 100644 --- a/question/type/gapselect/questionbase.php +++ b/question/type/gapselect/questionbase.php @@ -97,12 +97,12 @@ abstract class qtype_gapselect_question_base extends question_graded_automatical } public function get_question_summary() { - $question = $this->html_to_text($this->questiontext); + $question = $this->html_to_text($this->questiontext, $this->questiontextformat); $groups = array(); foreach ($this->choices as $group => $choices) { $cs = array(); foreach ($choices as $choice) { - $cs[] = $this->html_to_text($choice->text); + $cs[] = html_to_text($choice->text, 0, false); } $groups[] = '[[' . $group . ']] -> {' . implode(' / ', $cs) . '}'; } @@ -120,8 +120,8 @@ abstract class qtype_gapselect_question_base extends question_graded_automatical foreach ($this->places as $place => $group) { if (array_key_exists($this->field($place), $response) && $response[$this->field($place)]) { - $choices[] = '{' . $this->html_to_text($this->get_selected_choice( - $group, $response[$this->field($place)])->text) . '}'; + $choices[] = '{' . html_to_text($this->get_selected_choice( + $group, $response[$this->field($place)])->text, 0, false) . '}'; $allblank = false; } else { $choices[] = '{}'; @@ -286,7 +286,7 @@ abstract class qtype_gapselect_question_base extends question_graded_automatical $choiceno = $this->choiceorder[$group][$response[$fieldname]]; $choice = $this->choices[$group][$choiceno]; $parts[$place] = new question_classified_response( - $choiceno, $this->html_to_text($choice->text), + $choiceno, html_to_text($choice->text, 0, false), $this->get_right_choice_for($place) == $response[$fieldname]); } return $parts; diff --git a/question/type/gapselect/questiontypebase.php b/question/type/gapselect/questiontypebase.php index 067c592ead7..65662dca158 100644 --- a/question/type/gapselect/questiontypebase.php +++ b/question/type/gapselect/questiontypebase.php @@ -297,7 +297,7 @@ abstract class qtype_gapselect_base extends question_type { foreach ($question->choices[$group] as $i => $choice) { $choices[$i] = new question_possible_response( - $question->html_to_text($choice->text), + html_to_text($choice->text, 0, false), $question->rightchoices[$place] == $i); } $choices[null] = question_possible_response::no_response(); diff --git a/question/type/gapselect/rendererbase.php b/question/type/gapselect/rendererbase.php index 7a8913f6c3f..c26c5e1aaac 100644 --- a/question/type/gapselect/rendererbase.php +++ b/question/type/gapselect/rendererbase.php @@ -51,7 +51,7 @@ abstract class qtype_elements_embedded_in_question_text_renderer extends qtype_w $result = ''; $result .= html_writer::tag('div', $question->format_text($questiontext, - $qa, 'question', 'questiontext', $question->id), + $question->questiontextformat, $qa, 'question', 'questiontext', $question->id), array('class' => $this->qtext_classname(), 'id' => $qa->get_qt_field_name(''))); $result .= $this->post_qtext_elements($qa, $options); diff --git a/question/type/match/question.php b/question/type/match/question.php index 2f23e739821..ebb145d52b8 100644 --- a/question/type/match/question.php +++ b/question/type/match/question.php @@ -88,10 +88,10 @@ class qtype_match_question extends question_graded_automatically_with_countback } public function get_question_summary() { - $question = $this->html_to_text($this->questiontext); + $question = $this->html_to_text($this->questiontext, $this->questiontextformat); $stems = array(); foreach ($this->stemorder as $stemid) { - $stems[] = $this->html_to_text($this->stems[$stemid]); + $stems[] = $this->html_to_text($this->stems[$stemid], $this->stemformat[$stemid]); } $choices = array(); foreach ($this->choiceorder as $choiceid) { @@ -105,8 +105,8 @@ class qtype_match_question extends question_graded_automatically_with_countback $matches = array(); foreach ($this->stemorder as $key => $stemid) { if (array_key_exists($this->field($key), $response) && $response[$this->field($key)]) { - $matches[] = $this->html_to_text($this->stems[$stemid]) . ' -> ' . - $this->choices[$this->choiceorder[$response[$this->field($key)]]]; + $matches[] = $this->html_to_text($this->stems[$stemid], $this->stemformat[$stemid]) . + ' -> ' . $this->choices[$this->choiceorder[$response[$this->field($key)]]]; } } if (empty($matches)) { diff --git a/question/type/match/questiontype.php b/question/type/match/questiontype.php index f9fbcb806e9..4678b8d3f00 100644 --- a/question/type/match/questiontype.php +++ b/question/type/match/questiontype.php @@ -149,6 +149,7 @@ class qtype_match extends question_type { if ($matchsub->questiontext !== '') { $question->stems[$matchsub->id] = $matchsub->questiontext; + $question->stemformat[$matchsub->id] = $matchsub->questiontextformat; $question->right[$matchsub->id] = $key; } } @@ -181,7 +182,7 @@ class qtype_match extends question_type { $responses = array(); foreach ($q->choices as $choiceid => $choice) { $responses[$choiceid] = new question_possible_response( - $q->html_to_text($stem) . ': ' . $q->html_to_text($choice), + $q->html_to_text($stem, $q->stemformat[$stemid]) . ': ' . $choice, ($choiceid == $q->right[$stemid]) / count($q->stems)); } $responses[null] = question_possible_response::no_response(); diff --git a/question/type/match/renderer.php b/question/type/match/renderer.php index 6ba6a6a88b8..134024ae96b 100644 --- a/question/type/match/renderer.php +++ b/question/type/match/renderer.php @@ -59,7 +59,8 @@ class qtype_match_renderer extends qtype_with_combined_feedback_renderer { $result .= html_writer::start_tag('tr', array('class' => 'r' . $parity)); $fieldname = 'sub' . $key; - $result .= html_writer::tag('td', $question->format_text($question->stems[$stemid], + $result .= html_writer::tag('td', $question->format_text( + $question->stems[$stemid], $question->stemformat[$stemid], $qa, 'qtype_match', 'subquestion', $stemid), array('class' => 'text')); @@ -120,7 +121,8 @@ class qtype_match_renderer extends qtype_with_combined_feedback_renderer { $choices = $this->format_choices($question); $right = array(); foreach ($stemorder as $key => $stemid) { - $right[] = $question->format_text($question->stems[$stemid], $qa, + $right[] = $question->format_text($question->stems[$stemid], + $question->stemformat[$stemid], $qa, 'qtype_match', 'subquestion', $stemid) . ' – ' . $choices[$question->get_right_choice_for($stemid)]; } diff --git a/question/type/match/simpletest/testquestiontype.php b/question/type/match/simpletest/testquestiontype.php index 285c6612dd0..ce0db2d300d 100644 --- a/question/type/match/simpletest/testquestiontype.php +++ b/question/type/match/simpletest/testquestiontype.php @@ -76,10 +76,26 @@ class qtype_match_test extends UnitTestCase { test_question_maker::set_standard_combined_feedback_fields($q->options); $q->options->subquestions = array( - 14 => (object) array('id' => 14, 'questiontext' => 'frog', 'answertext' => 'amphibian'), - 15 => (object) array('id' => 15, 'questiontext' => 'cat', 'answertext' => 'mammal'), - 16 => (object) array('id' => 16, 'questiontext' => 'newt', 'answertext' => 'amphibian'), - 17 => (object) array('id' => 17, 'questiontext' => '', 'answertext' => 'insect'), + 14 => (object) array( + 'id' => 14, + 'questiontext' => 'frog', + 'questiontextformat' => FORMAT_HTML, + 'answertext' => 'amphibian'), + 15 => (object) array( + 'id' => 15, + 'questiontext' => 'cat', + 'questiontextformat' => FORMAT_HTML, + 'answertext' => 'mammal'), + 16 => (object) array( + 'id' => 16, + 'questiontext' => 'newt', + 'questiontextformat' => FORMAT_HTML, + 'answertext' => 'amphibian'), + 17 => (object) array( + 'id' => 17, + 'questiontext' => '', + 'questiontextformat' => FORMAT_HTML, + 'answertext' => 'insect'), ); return $q; diff --git a/question/type/multichoice/question.php b/question/type/multichoice/question.php index 28b1cd4d896..e3c4f882ba2 100644 --- a/question/type/multichoice/question.php +++ b/question/type/multichoice/question.php @@ -68,10 +68,11 @@ abstract class qtype_multichoice_base extends question_graded_automatically { } public function get_question_summary() { - $question = $this->html_to_text($this->questiontext); + $question = $this->html_to_text($this->questiontext, $this->questiontextformat); $choices = array(); foreach ($this->order as $ansid) { - $choices[] = $this->html_to_text($this->answers[$ansid]->answer); + $choices[] = $this->html_to_text($this->answers[$ansid]->answer, + $this->answers[$ansid]->answerformat); } return $question . ': ' . implode('; ', $choices); } @@ -157,7 +158,8 @@ class qtype_multichoice_single_question extends qtype_multichoice_base { return null; } $ansid = $this->order[$response['answer']]; - return $this->html_to_text($this->answers[$ansid]->answer); + return $this->html_to_text($this->answers[$ansid]->answer, + $this->answers[$ansid]->answerformat); } public function classify_response(array $response) { @@ -168,7 +170,7 @@ class qtype_multichoice_single_question extends qtype_multichoice_base { $choiceid = $this->order[$response['answer']]; $ans = $this->answers[$choiceid]; return array($this->id => new question_classified_response($choiceid, - $this->html_to_text($ans->answer), $ans->fraction)); + $this->html_to_text($ans->answer, $ans->answerformat), $ans->fraction)); } public function get_correct_response() { @@ -283,7 +285,8 @@ class qtype_multichoice_multi_question extends qtype_multichoice_base { foreach ($this->order as $key => $ans) { $fieldname = $this->field($key); if (array_key_exists($fieldname, $response) && $response[$fieldname]) { - $selectedchoices[] = $this->html_to_text($this->answers[$ans]->answer); + $selectedchoices[] = $this->html_to_text($this->answers[$ans]->answer, + $this->answers[$ans]->answerformat); } } if (empty($selectedchoices)) { @@ -304,7 +307,7 @@ class qtype_multichoice_multi_question extends qtype_multichoice_base { foreach ($this->answers as $ansid => $ans) { if (isset($selectedchoices[$ansid])) { $choices[$ansid] = new question_classified_response($ansid, - $this->html_to_text($ans->answer), $ans->fraction); + $this->html_to_text($ans->answer, $ans->answerformat), $ans->fraction); } } return $choices; diff --git a/question/type/multichoice/renderer.php b/question/type/multichoice/renderer.php index 0633a00ae9e..58545966ac2 100644 --- a/question/type/multichoice/renderer.php +++ b/question/type/multichoice/renderer.php @@ -95,8 +95,8 @@ abstract class qtype_multichoice_renderer_base extends qtype_with_combined_feedb } $radiobuttons[] = $hidden . html_writer::empty_tag('input', $inputattributes) . html_writer::tag('label', $this->number_in_style($value, $question->answernumbering) . - $question->format_text($ans->answer, $qa, - 'question', 'answer', $ansid), array('for' => $inputattributes['id'])); + $question->format_text($ans->answer, $ans->answerformat, + $qa, 'question', 'answer', $ansid), array('for' => $inputattributes['id'])); // $options->suppresschoicefeedback is a hack specific to the // oumultiresponse question type. It would be good to refactor to @@ -104,7 +104,8 @@ abstract class qtype_multichoice_renderer_base extends qtype_with_combined_feedb if ($options->feedback && empty($options->suppresschoicefeedback) && $isselected && trim($ans->feedback)) { $feedback[] = html_writer::tag('div', - $question->format_text($ans->feedback, $qa, 'question', 'answerfeedback', $ansid), + $question->format_text($ans->feedback, $ans->feedbackformat, + $qa, 'question', 'answerfeedback', $ansid), array('class' => 'specificfeedback')); } else { $feedback[] = ''; @@ -224,7 +225,8 @@ class qtype_multichoice_single_renderer extends qtype_multichoice_renderer_base if (question_state::graded_state_for_fraction($ans->fraction) == question_state::$gradedright) { return get_string('correctansweris', 'qtype_multichoice', - $question->format_text($ans->answer, $qa, 'question', 'answer', $ansid)); + $question->format_text($ans->answer, $ans->answerformat, + $qa, 'question', 'answer', $ansid)); } } @@ -274,7 +276,8 @@ class qtype_multichoice_multi_renderer extends qtype_multichoice_renderer_base { $right = array(); foreach ($question->answers as $ansid => $ans) { if ($ans->fraction > 0) { - $right[] = $question->format_text($ans->answer, $qa, 'question', 'answer', $ansid); + $right[] = $question->format_text($ans->answer, $ans->answerformat, + $qa, 'question', 'answer', $ansid); } } diff --git a/question/type/questionbase.php b/question/type/questionbase.php index c814fd58686..5b0a3332f14 100644 --- a/question/type/questionbase.php +++ b/question/type/questionbase.php @@ -188,7 +188,7 @@ abstract class question_definition { * @return string|null a plain text summary of this question. */ public function get_question_summary() { - return $this->html_to_text($this->questiontext); + return $this->html_to_text($this->questiontext, $this->questiontextformat); } /** @@ -256,6 +256,7 @@ abstract class question_definition { * this question. * * @param string $text some content that needs to be output. + * @param int $format the FORMAT_... constant. * @param question_attempt $qa the question attempt. * @param string $component used for rewriting file area URLs. * @param string $filearea used for rewriting file area URLs. @@ -263,37 +264,37 @@ abstract class question_definition { * parts of the question do not need to be cleaned, and student input does. * @return string the text formatted for output by format_text. */ - public function format_text($text, $qa, $component, $filearea, $itemid, $clean = false) { - // TODO format. + public function format_text($text, $format, $qa, $component, $filearea, $itemid, $clean = false) { $formatoptions = new stdClass(); $formatoptions->noclean = !$clean; $formatoptions->para = false; $text = $qa->rewrite_pluginfile_urls($text, $component, $filearea, $itemid); - return format_text($text, $this->questiontextformat, $formatoptions); + return format_text($text, $format, $formatoptions); } /** * Convert some part of the question text to plain text. This might be used, * for example, by get_response_summary(). * @param string $text The HTML to reduce to plain text. + * @param int $format the FORMAT_... constant. + * @return string the equivalent plain text. */ - public function html_to_text($text) { + public function html_to_text($text, $format) { $formatoptions = new stdClass(); $formatoptions->noclean = true; - return html_to_text(format_text($text, $this->questiontextformat, $formatoptions), - 0, false); + return html_to_text(format_text($text, $format, $formatoptions), 0, false); } /** @return the result of applying {@link format_text()} to the question text. */ public function format_questiontext($qa) { - return $this->format_text($this->questiontext, $qa, - 'question', 'questiontext', $this->id); + return $this->format_text($this->questiontext, $this->questiontextformat, + $qa, 'question', 'questiontext', $this->id); } /** @return the result of applying {@link format_text()} to the general feedback. */ public function format_generalfeedback($qa) { - return $this->format_text($this->generalfeedback, $qa, - 'question', 'generalfeedback', $this->id); + return $this->format_text($this->generalfeedback, $this->generalfeedbackformat, + $qa, 'question', 'generalfeedback', $this->id); } /** @@ -600,7 +601,7 @@ abstract class question_graded_automatically extends question_with_responses } public function format_hint(question_hint $hint, question_attempt $qa) { - return $this->format_text($hint->hint, $qa, 'question', 'hint', $hint->id); + return $this->format_text($hint->hint, $hint->hintformat, $qa, 'question', 'hint', $hint->id); } } @@ -707,6 +708,9 @@ class question_answer { /** @var string the answer. */ public $answer; + /** @var integer one of the FORMAT_... constans. */ + public $answerformat = FORMAT_PLAIN; + /** @var number the fraction this answer is worth. */ public $fraction; @@ -718,9 +722,12 @@ class question_answer { /** * Constructor. + * @param int $id the answer. * @param string $answer the answer. + * @param int $answerformat the format of the answer. * @param number $fraction the fraction this answer is worth. * @param string $feedback the feedback for this answer. + * @param int $feedbackformat the format of the feedback. */ public function __construct($id, $answer, $fraction, $feedback, $feedbackformat) { $this->id = $id; diff --git a/question/type/questiontype.php b/question/type/questiontype.php index 9afec52cf37..048ca224f81 100644 --- a/question/type/questiontype.php +++ b/question/type/questiontype.php @@ -37,7 +37,7 @@ require_once($CFG->dirroot . '/question/engine/lib.php'); * for, and the circumstances under which you might need to override it. * * Note: the questiontype API should NOT be considered stable yet. Very few - * question tyeps have been produced yet, so we do not yet know all the places + * question types have been produced yet, so we do not yet know all the places * where the current API is insufficient. I would rather learn from the * experiences of the first few question type implementors, and improve the * interface to meet their needs, rather the freeze the API prematurely and diff --git a/question/type/rendererbase.php b/question/type/rendererbase.php index 2354c8e8398..887327ae72f 100644 --- a/question/type/rendererbase.php +++ b/question/type/rendererbase.php @@ -252,10 +252,11 @@ abstract class qtype_with_combined_feedback_renderer extends qtype_renderer { } $feedback = ''; - $feedbackfield = $state->get_feedback_class() . 'feedback'; - if ($question->$feedbackfield) { - $feedback .= $question->format_text($question->$feedbackfield, $qa, - 'question', $feedbackfield, $question->id); + $field = $state->get_feedback_class() . 'feedback'; + $format = $state->get_feedback_class() . 'feedbackformat'; + if ($question->$field) { + $feedback .= $question->format_text($question->$field, $question->$format, + $qa, 'question', $field, $question->id); } return $feedback; diff --git a/question/type/shortanswer/renderer.php b/question/type/shortanswer/renderer.php index 58ee4b2efd9..a391658c7bd 100644 --- a/question/type/shortanswer/renderer.php +++ b/question/type/shortanswer/renderer.php @@ -106,8 +106,8 @@ class qtype_shortanswer_renderer extends qtype_renderer { return ''; } - return $question->format_text($answer->feedback, $qa, - 'question', 'answerfeedback', $answer->id); + return $question->format_text($answer->feedback, $answer->feedbackformat, + $qa, 'question', 'answerfeedback', $answer->id); } public function correct_response(question_attempt $qa) { diff --git a/question/type/truefalse/questiontype.php b/question/type/truefalse/questiontype.php index 39422c065e3..65f9b1fe21f 100644 --- a/question/type/truefalse/questiontype.php +++ b/question/type/truefalse/questiontype.php @@ -137,6 +137,8 @@ class qtype_truefalse extends question_type { } $question->truefeedback = $answers[$questiondata->options->trueanswer]->feedback; $question->falsefeedback = $answers[$questiondata->options->falseanswer]->feedback; + $question->truefeedbackformat = $answers[$questiondata->options->trueanswer]->feedbackformat; + $question->falsefeedbackformat = $answers[$questiondata->options->falseanswer]->feedbackformat; $question->trueanswerid = $questiondata->options->trueanswer; $question->falseanswerid = $questiondata->options->falseanswer; } diff --git a/question/type/truefalse/renderer.php b/question/type/truefalse/renderer.php index 2f5d8289e76..bc7fa079fc3 100644 --- a/question/type/truefalse/renderer.php +++ b/question/type/truefalse/renderer.php @@ -127,11 +127,11 @@ class qtype_truefalse_renderer extends qtype_renderer { $response = $qa->get_last_qt_var('answer', ''); if ($response) { - return $question->format_text($question->truefeedback, $qa, - 'question', 'answerfeedback', $question->trueanswerid); + return $question->format_text($question->truefeedback, $question->truefeedbackformat, + $qa, 'question', 'answerfeedback', $question->trueanswerid); } else { - return $question->format_text($question->falsefeedback, $qa, - 'question', 'answerfeedback', $question->falseanswerid); + return $question->format_text($question->falsefeedback, $question->falsefeedbackformat, + $qa, 'question', 'answerfeedback', $question->falseanswerid); } }