MDL-73128 badges: Fix warning with external badges

This commit is contained in:
Sara Arjona 2021-11-19 12:57:33 +01:00
parent eab63d2cfe
commit a0407f6d17

View File

@ -59,7 +59,8 @@ class core_badges_renderer extends plugin_renderer_base {
$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)),