@@ -86,19 +86,21 @@ protected function question_survey_display($response, $descendantsdata, $blankqu
8686 } else {
8787 $ draftitemid = file_get_submitted_draft_itemid ($ elname );
8888 }
89- $ options = self ::get_file_manager_option ();
9089 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 ());
9292 } else {
9393 $ draftitemid = file_get_unused_draft_itemid ();
9494 }
9595 // Filemanager form element implementation is far from optimal, we need to rework this if we ever fix it...
9696 require_once ("$ CFG ->dirroot /lib/form/filemanager.php " );
9797
98- $ options ->client_id = uniqid ();
99- $ options ->itemid = $ draftitemid ;
100- $ options ->target = $ this ->id ;
101- $ options ->name = $ elname ;
98+ $ options = array_merge (self ::get_file_manager_option (), [
99+ 'client_id ' => uniqid (),
100+ 'itemid ' => $ draftitemid ,
101+ 'target ' => $ this ->id ,
102+ 'name ' => $ elname ,
103+ ]);
102104 $ fm = new form_filemanager ($ options );
103105 $ output = $ PAGE ->get_renderer ('core ' , 'files ' );
104106
@@ -141,12 +143,12 @@ public function response_complete($responsedata) {
141143 * @return array
142144 */
143145 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+ ] ;
150152 }
151153
152154 /**
0 commit comments