Images and other attachments are broken for the Cloze (Multianswer/Embedded answers)
question type. Attachments added in the browser appear to work, but they may vanish
from the server at any time. When creating questions in the browser,
'file_prepare_draft_area' gets called for the appropriate fields in the Cloze
subquestions, which stores the attachments temporarily and rewrites the links to use draftfile.php, but 'file_save_draft_area_files' is never called as it should be, so the files are never permanently stored and the links are never rewritten to use the @@PLUGINFILE@@ placeholder. As a result, the links appear to work during editing and quiz previews/attempts, but they are not handled as intended by the design of the Moodle
file API, and the files may be deleted when the draft area is reclaimed. In addition,
third-party code like ours must either follow the same incorrect pattern, and also
risk attachment loss, or support publishing attachments using the same pattern used
by other question types, which will not be lost but will also not be displayed on
the server, because the code for this question type also never calls 'quiz_rewrite_question_urls'. The only other alternative is to fail to support attachments altogether for these questions. It occurred to us that perhaps there was an unwritten assumption that the Cloze subquestions did not support attachments, but they are not prevented in the user interface, and subquestion handling is mostly delegated to the individual plugin for the subquestion type, which does support attachments. Anyway, can this issue be clarified, or fixed to follow the same pattern used by the other question types with regard to attachments?
- duplicates
-
MDL-26511 Adding images in Cloze vertical and horizontal display multiplechoices subquestions
-
- Reopened
-