diff --git a/mod/lti/edit_form.php b/mod/lti/edit_form.php index e166910d55e..c10718fce26 100644 --- a/mod/lti/edit_form.php +++ b/mod/lti/edit_form.php @@ -437,7 +437,9 @@ class mod_lti_edit_types_form extends moodleform { // change to the existing value. Add the option as a disabled to make this clear. Once changed, it cannot be set again. // This isn't supported from 4.3 onward in the creation of new tool types. foreach (['lti_sendname', 'lti_sendemailaddr'] as $elementname) { - if ($this->_form->_defaultValues[$elementname] == LTI_SETTING_DELEGATE) { + if (!empty($this->_form->_defaultValues[$elementname]) + && $this->_form->_defaultValues[$elementname] == LTI_SETTING_DELEGATE) { + $elementarr = array_filter($this->_form->_elements, function ($element) use($elementname) { return !empty($element->_attributes['name']) && $element->_attributes['name'] == $elementname; }); diff --git a/mod/lti/mod_form.php b/mod/lti/mod_form.php index 0ab5781a04a..7980ff49d7e 100644 --- a/mod/lti/mod_form.php +++ b/mod/lti/mod_form.php @@ -473,7 +473,7 @@ class mod_lti_mod_form extends moodleform_mod { $mform->setType('secureicon', PARAM_URL); // Add standard course module grading elements, and show them if the tool type + instance config permits it. - if (in_array($config['acceptgrades'], [LTI_SETTING_ALWAYS, LTI_SETTING_DELEGATE])) { + if (!empty($config['acceptgrades']) && in_array($config['acceptgrades'], [LTI_SETTING_ALWAYS, LTI_SETTING_DELEGATE])) { $elementnamesbeforegrading = $this->_form->_elementIndex; $this->standard_grading_coursemodule_elements(); $elementnamesaftergrading = $this->_form->_elementIndex;