MDL-60145 course: fix bug with group restictions button during mod edit
authorJake Dallimore <jake@moodle.com>
Tue, 21 Aug 2018 09:28:30 +0000 (17:28 +0800)
committerJake Dallimore <jake@moodle.com>
Wed, 10 Oct 2018 00:40:07 +0000 (08:40 +0800)
If a mod doesn't support groups, then we remove the grouping element,
and now also the 'add group/group restriction' helper button too.

course/moodleform_mod.php

index b38af38..a3235ce 100644 (file)
@@ -290,6 +290,10 @@ abstract class moodleform_mod extends moodleform {
                 if ($mform->elementExists('groupingid')) {
                     $mform->removeElement('groupingid');
                 }
+                // Nor does the group restrictions button.
+                if ($mform->elementExists('restrictgroupbutton')) {
+                    $mform->removeElement('restrictgroupbutton');
+                }
             }
         }