MDL-62815 mod_lti: fix error when clicking 'Select content' option
[moodle.git] / mod / lti / mod_form.php
index 1a6fdd8..8eb9fac 100644 (file)
@@ -162,6 +162,13 @@ class mod_lti_mod_form extends moodleform_mod {
         } else {
             $mform->addElement('hidden', 'typeid', $typeid);
             $mform->setType('typeid', PARAM_INT);
+            if ($typeid) {
+                $config = lti_get_type_config($typeid);
+                if (!empty($config['contentitem'])) {
+                    $mform->addElement('hidden', 'contentitem', 1);
+                    $mform->setType('contentitem', PARAM_INT);
+                }
+            }
         }
 
         // Add button that launches the content-item selection dialogue.