MDL-56301 course: Use value for intro field if set in a mods function
authorDonald Barrett <donald.barrett@learningworks.co.nz>
Wed, 16 Nov 2016 09:08:59 +0000 (22:08 +1300)
committerJake Dallimore <jake@moodle.com>
Tue, 6 Dec 2016 02:34:38 +0000 (10:34 +0800)
Respects a module that has set a value for the db field intro in it's lib function modulename_add_instance.

course/modlib.php

index 1eaa8f9..24385b8 100644 (file)
@@ -145,6 +145,9 @@ function add_moduleinfo($moduleinfo, $course, $mform = null) {
     // Update embedded links and save files.
     $modcontext = context_module::instance($moduleinfo->coursemodule);
     if (!empty($introeditor)) {
+        // This will respect a module that has set a value for intro in it's modname_add_instance() function.
+        $introeditor['text'] = $moduleinfo->intro;
+
         $moduleinfo->intro = file_save_draft_area_files($introeditor['itemid'], $modcontext->id,
                                                       'mod_'.$moduleinfo->modulename, 'intro', 0,
                                                       array('subdirs'=>true), $introeditor['text']);