diff --git a/course/format/singleactivity/lib.php b/course/format/singleactivity/lib.php index 4c9289b1acf..65cd546dc8f 100644 --- a/course/format/singleactivity/lib.php +++ b/course/format/singleactivity/lib.php @@ -338,16 +338,10 @@ class format_singleactivity extends format_base { * @return bool|null (null if the check is not possible) */ public function activity_has_subtypes() { - global $CFG; if (!($modname = $this->get_activitytype())) { return null; } - $libfile = "$CFG->dirroot/mod/$modname/lib.php"; - if (!file_exists($libfile)) { - return null; - } - include_once($libfile); - return function_exists($modname. '_get_types'); + return component_callback('mod_' . $modname, 'get_types', array(), MOD_SUBTYPE_NO_CHILDREN) !== MOD_SUBTYPE_NO_CHILDREN; } /** diff --git a/mod/lti/mod_form.php b/mod/lti/mod_form.php index 3652b475787..1df25e30fa4 100644 --- a/mod/lti/mod_form.php +++ b/mod/lti/mod_form.php @@ -75,10 +75,12 @@ class mod_lti_mod_form extends moodleform_mod { $mform->setAdvanced('introeditor'); // Display the label to the right of the checkbox so it looks better & matches rest of the form. - $coursedesc = $mform->getElement('showdescription'); - if (!empty($coursedesc)) { - $coursedesc->setText(' ' . $coursedesc->getLabel()); - $coursedesc->setLabel(' '); + if ($mform->elementExists('showdescription')) { + $coursedesc = $mform->getElement('showdescription'); + if (!empty($coursedesc)) { + $coursedesc->setText(' ' . $coursedesc->getLabel()); + $coursedesc->setLabel(' '); + } } $mform->setAdvanced('showdescription');