mirror of
https://github.com/moodle/moodle.git
synced 2025-04-18 23:15:38 +02:00
MDL-79862 completion: Improve error handling for default completion
This commit is contained in:
parent
b58d1fd4e2
commit
b4816367b7
@ -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']);
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user