Merge branch 'MDL-79862-master' of https://github.com/aanabit/moodle

This commit is contained in:
Sara Arjona 2023-12-05 16:35:20 +01:00
commit 51a70cf44e
No known key found for this signature in database
2 changed files with 12 additions and 2 deletions

View File

@ -129,7 +129,15 @@ class core_completion_defaultedit_form extends core_completion_edit_base_form {
$this->get_suffix()
);
$data = (array)$data;
$modform->data_preprocessing($data);
try {
$modform->data_preprocessing($data);
} catch (moodle_exception $e) {
debugging(
'data_preprocessing function of module ' . $modnames[0] .
' should be fixed so it can be shown together with other Default activity completion forms',
DEBUG_DEVELOPER
);
}
// Unset fields that will conflict with this form and set data to this form.
unset($data['cmid']);
unset($data['modids']);

View File

@ -125,7 +125,9 @@ abstract class core_completion_edit_base_form extends moodleform {
' has wrong suffix and has been removed from the form. This has to be fixed by the developer',
DEBUG_DEVELOPER
);
$moduleform->_form->removeElement($customcompletionelement);
if ($moduleform->_form->elementExists($customcompletionelement)) {
$moduleform->_form->removeElement($customcompletionelement);
}
}
}
}