Home
Documentation
Downloads
Demo
Tracker
Development
Translation
Moodle.net
Search
projects
/
moodle.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
1d11669
)
MDL-50670 course: apply defaults when format was switched
author
Marina Glancy
<marina@moodle.com>
Fri, 5 May 2017 06:47:27 +0000
(14:47 +0800)
committer
Marina Glancy
<marina@moodle.com>
Fri, 5 May 2017 06:47:27 +0000
(14:47 +0800)
course/format/lib.php
patch
|
blob
|
blame
|
history
diff --git
a/course/format/lib.php
b/course/format/lib.php
index
4c55764
..
a895b53
100644
(file)
--- a/
course/format/lib.php
+++ b/
course/format/lib.php
@@
-700,7
+700,9
@@
abstract class format_base {
if (isset($option['type'])) {
$mform->setType($optionname, $option['type']);
}
- if (is_null($mform->getElementValue('id')) && isset($option['default'])) {
+ if (isset($option['default']) && !array_key_exists($optionname, $mform->_defaultValues)) {
+ // Set defaults for the elements in the form.
+ // Since we call this method after set_data() make sure that we don't override what was already set.
$mform->setDefault($optionname, $option['default']);
}
}