MDL-36985 core_files: added option to remove draft files on save

text areas can now specify $options['removeorphaneddrafts'] when saving
their data using file_postupdate_standard_editor(). If set to true,
this option clears all user drafts which are not referenced in the text
This commit is contained in:
Jake Dallimore 2017-07-27 16:47:09 +08:00
parent 27466d7548
commit f3c2afd0e8
3 changed files with 91 additions and 6 deletions

View file

@ -169,12 +169,13 @@ class assign_submission_onlinetext extends assign_submission_plugin {
* @return array
*/
private function get_edit_options() {
$editoroptions = array(
'noclean' => false,
'maxfiles' => EDITOR_UNLIMITED_FILES,
'maxbytes' => $this->assignment->get_course()->maxbytes,
'context' => $this->assignment->get_context(),
'return_types' => (FILE_INTERNAL | FILE_EXTERNAL | FILE_CONTROLLED_LINK)
$editoroptions = array(
'noclean' => false,
'maxfiles' => EDITOR_UNLIMITED_FILES,
'maxbytes' => $this->assignment->get_course()->maxbytes,
'context' => $this->assignment->get_context(),
'return_types' => (FILE_INTERNAL | FILE_EXTERNAL | FILE_CONTROLLED_LINK),
'removeorphaneddrafts' => true // Whether or not to remove any draft files which aren't referenced in the text.
);
return $editoroptions;
}