MDL-55366 mod_lesson: Fix warning with TF page.
authorAdrian Greeve <adrian@moodle.com>
Thu, 28 Jul 2016 03:55:11 +0000 (11:55 +0800)
committerAdrian Greeve <adrian@moodle.com>
Mon, 15 Aug 2016 02:17:41 +0000 (10:17 +0800)
Having an image in the answer text would create a warning.

mod/lesson/pagetypes/matching.php
mod/lesson/pagetypes/truefalse.php

index 94ba3aa..b784f8e 100644 (file)
@@ -572,9 +572,7 @@ class lesson_display_answer_form_matching extends moodleform {
                     // Temporary fixed until MDL-38885 gets integrated
                     $mform->setType('response', PARAM_TEXT);
                 }
-                $context = context_module::instance($PAGE->cm->id);
-                $answer->answer = file_rewrite_pluginfile_urls($answer->answer, 'pluginfile.php', $context->id,
-                        'mod_lesson', 'page_answers', $answer->id);
+                $answer = lesson_page_type_matching::rewrite_answers_urls($answer);
                 $mform->addElement('select', $responseid, format_text($answer->answer,$answer->answerformat,$options), $responseoptions, $disabled);
                 $mform->setType($responseid, PARAM_TEXT);
                 if ($hasattempt) {
index 8ce8f09..f8dd81f 100644 (file)
@@ -416,6 +416,7 @@ class lesson_display_answer_form_truefalse extends moodleform {
                 $ansid = 'answer_id';
             }
 
+            $answer = lesson_page_type_truefalse::rewrite_answers_urls($answer);
             $radiobuttons[] = $mform->createElement('radio', $ansid, null,
                 format_text($answer->answer, $answer->answerformat, $options), $answer->id, $disabled);