Skip to content

Commit

Permalink
Merge pull request #81 from sarahjcotton/WR438262-other-fixes
Browse files Browse the repository at this point in the history
WR438262: Use empty instead of count to avoid errors when no content
  • Loading branch information
dmitriim authored Jul 31, 2024
2 parents 21f9cbb + a5706aa commit 69ac1a6
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions locallib.php
Original file line number Diff line number Diff line change
Expand Up @@ -458,7 +458,7 @@ public function get_form_elements_for_user($submission, MoodleQuickForm $mform,
$remotehost->name = $remotehost->sitename;

// See if any of views are already in use, we will remove them from select.
if (count($viewids) || count($views['collections']['data'])) {
if (!empty($viewids) || !empty($views['collections']['data'])) {
$mform->addElement(
'static',
'',
Expand All @@ -471,7 +471,7 @@ public function get_form_elements_for_user($submission, MoodleQuickForm $mform,
$mform->setType('viewid', PARAM_ALPHANUM);
$mform->setDefault('viewid', 'none');

if (count($views['data'])) {
if (!empty($views['data'])) {
$mform->addElement('static', '',
get_string('viewsby', 'assignsubmission_maharaws', $views['displayname'])
);
Expand All @@ -482,7 +482,7 @@ public function get_form_elements_for_user($submission, MoodleQuickForm $mform,
$mform->addElement('radio', 'viewid', '', $anchor, 'v' . $view['id']);
}
}
if (count($views['collections']['data'])) {
if (!empty($views['collections']['data'])) {
$mform->addElement('static', 'collection_by',
get_string('collectionsby', 'assignsubmission_maharaws', $views['displayname'])
);
Expand Down

0 comments on commit 69ac1a6

Please sign in to comment.