MDL-59368 groups: Show no groups instead of ''
authorDamyon Wiese <damyon@moodle.com>
Wed, 5 Jul 2017 02:10:13 +0000 (10:10 +0800)
committerDamyon Wiese <damyon@moodle.com>
Wed, 12 Jul 2017 02:07:58 +0000 (10:07 +0800)
This is on the inplace editable for a users course groups.

group/classes/output/user_groups_editable.php

index 17c99bd..12c8c57 100644 (file)
@@ -92,7 +92,11 @@ class user_groups_editable extends \core\output\inplace_editable {
             $listofgroups[] = format_string($this->coursegroups[$id]->name, true, ['context' => $this->context]);
         }
 
-        $this->displayvalue = implode($listofgroups, ', ');
+        if (!empty($listofgroups)) {
+            $this->displayvalue = implode($listofgroups, ', ');
+        } else {
+            $this->displayvalue = get_string('groupsnone');
+        }
         return parent::export_for_template($output);
     }