From a0407f6d17250c9f7969e4c9f47998f1221de4bb Mon Sep 17 00:00:00 2001 From: Sara Arjona Date: Fri, 19 Nov 2021 12:57:33 +0100 Subject: [PATCH] MDL-73128 badges: Fix warning with external badges --- badges/renderer.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/badges/renderer.php b/badges/renderer.php index 36929f6a765..cc79994797d 100644 --- a/badges/renderer.php +++ b/badges/renderer.php @@ -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)),