MDL-67966 mod_workshop: Use condition to verify form is using editor

This adds a condition to check if Online text is used
for the submission. The functions file_postupdate_standard_editor
and file_postupdate_standard_filemanager needs the property
content_editor of the formdata.
This commit is contained in:
Joshua Ebarvia
2022-06-02 10:27:41 +08:00
committed by Jun Pataleta
parent 117b24013b
commit d5059795c9
+7 -4
View File
@@ -157,10 +157,13 @@ if ($edit and $canmanage) {
}
// Save and relink embedded images and save attachments.
$formdata = file_postupdate_standard_editor($formdata, 'content', $workshop->submission_content_options(),
$workshop->context, 'mod_workshop', 'submission_content', $example->id);
$formdata = file_postupdate_standard_filemanager($formdata, 'attachment', $workshop->submission_attachment_options(),
$workshop->context, 'mod_workshop', 'submission_attachment', $example->id);
// To be used when Online text is allowed as a submission type.
if (!empty($formdata->content_editor)) {
$formdata = file_postupdate_standard_editor($formdata, 'content', $workshop->submission_content_options(),
$workshop->context, 'mod_workshop', 'submission_content', $example->id);
$formdata = file_postupdate_standard_filemanager($formdata, 'attachment', $workshop->submission_attachment_options(),
$workshop->context, 'mod_workshop', 'submission_attachment', $example->id);
}
if (empty($formdata->attachment)) {
// explicit cast to zero integer