MDL-47247 mod_folder: Apply site config when showexpanded is not set
authorMihail Geshoski <mihail@moodle.com>
Wed, 5 Dec 2018 03:41:04 +0000 (11:41 +0800)
committerMihail Geshoski <mihail@moodle.com>
Tue, 29 Jan 2019 00:58:14 +0000 (08:58 +0800)
mod/folder/lib.php

index 3a54f19..3dd167e 100644 (file)
@@ -105,6 +105,10 @@ function folder_add_instance($data, $mform) {
     $draftitemid = $data->files;
 
     $data->timemodified = time();
+    // If 'showexpanded' is not set, apply the site config.
+    if (!isset($data->showexpanded)) {
+        $data->showexpanded = get_config('folder', 'showexpanded');
+    }
     $data->id = $DB->insert_record('folder', $data);
 
     // we need to use context now, so we need to make sure all needed info is already in db