Skip to content

Commit

Permalink
MDL-73128 badges: Fix warning with external badges
Browse files Browse the repository at this point in the history
  • Loading branch information
sarjona committed Nov 22, 2021
1 parent eab63d2 commit a0407f6
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion badges/renderer.php
Expand Up @@ -59,7 +59,8 @@ public function print_badges_list($badges, $userid, $profile = false, $external

$name = html_writer::tag('span', $bname, array('class' => 'badge-name'));

$image = html_writer::empty_tag('img', ['src' => $imageurl, 'class' => 'badge-image', 'alt' => $badge->imagecaption]);
$imagecaption = $badge->imagecaption ?? '';
$image = html_writer::empty_tag('img', ['src' => $imageurl, 'class' => 'badge-image', 'alt' => $imagecaption]);
if (!empty($badge->dateexpire) && $badge->dateexpire < time()) {
$image .= $this->output->pix_icon('i/expired',
get_string('expireddate', 'badges', userdate($badge->dateexpire)),
Expand Down

0 comments on commit a0407f6

Please sign in to comment.