From acb262cc75bb485b8794a7fb43758b2fc139e91e Mon Sep 17 00:00:00 2001 From: Maxime Rainville Date: Fri, 3 May 2024 10:42:27 +1200 Subject: [PATCH] ENH Update AttributesHTML to output alt attribute even if it's empty --- src/View/AttributesHTML.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/View/AttributesHTML.php b/src/View/AttributesHTML.php index 66f066d30..5a3e7ec99 100644 --- a/src/View/AttributesHTML.php +++ b/src/View/AttributesHTML.php @@ -105,9 +105,9 @@ trait AttributesHTML $attributes = (array) $attributes; - $attributes = array_filter($attributes ?? [], function ($v) { - return ($v || $v === 0 || $v === '0'); - }); + $attributes = array_filter($attributes ?? [], function ($v, $k) { + return ($k == 'alt' || $v || $v === 0 || $v === '0'); + }, ARRAY_FILTER_USE_BOTH); if ($exclude) { $attributes = array_diff_key(