@@ -86,20 +86,22 @@ protected function question_survey_display($response, $descendantsdata, $blankqu
86
86
} else {
87
87
$ draftitemid = file_get_submitted_draft_itemid ($ elname );
88
88
}
89
- $ options = self ::get_file_manager_option ();
90
89
if ($ draftitemid > 0 ) {
91
- file_prepare_draft_area ($ draftitemid , $ this ->context ->id , 'mod_questionnaire ' , 'file ' , $ this ->id , $ options );
90
+ file_prepare_draft_area ($ draftitemid , $ this ->context ->id ,
91
+ 'mod_questionnaire ' , 'file ' , $ this ->id , self ::get_file_manager_option ());
92
92
} else {
93
93
$ draftitemid = file_get_unused_draft_itemid ();
94
94
}
95
95
// Filemanager form element implementation is far from optimal, we need to rework this if we ever fix it...
96
96
require_once ("$ CFG ->dirroot /lib/form/filemanager.php " );
97
97
98
- $ options ->client_id = uniqid ();
99
- $ options ->itemid = $ draftitemid ;
100
- $ options ->target = $ this ->id ;
101
- $ options ->name = $ elname ;
102
- $ fm = new form_filemanager ($ options );
98
+ $ options = array_merge (self ::get_file_manager_option (), [
99
+ 'client_id ' => uniqid (),
100
+ 'itemid ' => $ draftitemid ,
101
+ 'target ' => $ this ->id ,
102
+ 'name ' => $ elname ,
103
+ ]);
104
+ $ fm = new form_filemanager ((object )$ options );
103
105
$ output = $ PAGE ->get_renderer ('core ' , 'files ' );
104
106
105
107
$ html = '<div class="form-filemanager" data-fieldtype="filemanager"> ' .
@@ -141,12 +143,12 @@ public function response_complete($responsedata) {
141
143
* @return array
142
144
*/
143
145
public static function get_file_manager_option () {
144
- $ options = new \ stdClass ();
145
- $ options -> mainfile = '' ;
146
- $ options -> subdirs = false ;
147
- $ options -> accepted_types = ['image ' , '.pdf ' ];
148
- $ options -> maxfiles = 1 ;
149
- return $ options ;
146
+ return [
147
+ ' mainfile ' => '' ,
148
+ ' subdirs ' => false ,
149
+ ' accepted_types ' => ['image ' , '.pdf ' ],
150
+ ' maxfiles ' => 1 ,
151
+ ] ;
150
152
}
151
153
152
154
/**
0 commit comments