Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

MDL-30764 Activity settings: do not disable grouping dropdown if it i…

…s already set
  • Loading branch information...
commit 782b21dc0f57cfaa491b14743f73bc8efcfeafbc 1 parent acb3bf8
@sammarshallou sammarshallou authored
Showing with 15 additions and 10 deletions.
  1. +15 −10 course/moodleform_mod.php
View
25 course/moodleform_mod.php
@@ -173,16 +173,21 @@ function definition_after_data() {
}
}
- if ($mform->elementExists('groupmode') and !$mform->elementExists('groupmembersonly') and empty($COURSE->groupmodeforce)) {
- $mform->disabledIf('groupingid', 'groupmode', 'eq', NOGROUPS);
-
- } else if (!$mform->elementExists('groupmode') and $mform->elementExists('groupmembersonly')) {
- $mform->disabledIf('groupingid', 'groupmembersonly', 'notchecked');
-
- } else if (!$mform->elementExists('groupmode') and !$mform->elementExists('groupmembersonly')) {
- // groupings have no use without groupmode or groupmembersonly
- if ($mform->elementExists('groupingid')) {
- $mform->removeElement('groupingid');
+ // Don't disable/remove groupingid if it is currently set to something,
+ // otherwise you cannot turn it off at same time as turning off other
+ // option (MDL-30764)
+ if (empty($this->_cm) || !$this->_cm->groupingid) {
+ if ($mform->elementExists('groupmode') and !$mform->elementExists('groupmembersonly') and empty($COURSE->groupmodeforce)) {
+ $mform->disabledIf('groupingid', 'groupmode', 'eq', NOGROUPS);
+
+ } else if (!$mform->elementExists('groupmode') and $mform->elementExists('groupmembersonly')) {
+ $mform->disabledIf('groupingid', 'groupmembersonly', 'notchecked');
+
+ } else if (!$mform->elementExists('groupmode') and !$mform->elementExists('groupmembersonly')) {
+ // groupings have no use without groupmode or groupmembersonly
+ if ($mform->elementExists('groupingid')) {
+ $mform->removeElement('groupingid');
+ }
}
}
Please sign in to comment.
Something went wrong with that request. Please try again.