MDL-87334 course: looser check for empty return field editing course.
When the course format switcher reloads the form, the `$returnto` parameter is of type string: "0", rather of type integer per initial load. In this case the `empty(...)` check is verifying all of empty string, 0 (integer) and "0" (string). Hurrah for PHP type checking.
This commit is contained in:
@@ -429,7 +429,7 @@ class course_edit_form extends moodleform {
|
||||
// When two elements we need a group.
|
||||
$buttonarray = array();
|
||||
$classarray = array('class' => 'form-submit');
|
||||
if ($returnto !== 0) {
|
||||
if (!empty($returnto)) {
|
||||
$buttonarray[] = &$mform->createElement('submit', 'saveandreturn', get_string('savechangesandreturn'), $classarray);
|
||||
}
|
||||
$buttonarray[] = &$mform->createElement('submit', 'saveanddisplay', get_string('savechangesanddisplay'), $classarray);
|
||||
|
||||
Reference in New Issue
Block a user