Skip to content

Commit

Permalink
MDL-67966 mod_workshop: Use condition to verify form is using editor
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
kiratskitizing authored and junpataleta committed Jun 2, 2022
1 parent 117b240 commit d505979
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions mod/workshop/exsubmission.php
Original file line number Diff line number Diff line change
Expand Up @@ -157,10 +157,13 @@
}

// 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
Expand Down

0 comments on commit d505979

Please sign in to comment.