From 7546e5745d2bb3e2e874a562a0adf04081c44297 Mon Sep 17 00:00:00 2001 From: Bradley Taylor Date: Tue, 12 Oct 2021 16:30:58 +0100 Subject: [PATCH] Add alt attribute to image on PCPInfo template. It is an accessibility best-practice that all images should have alt text. If a description has been provided, we use that text, otherwise an empty alt text is used (i.e. the image is treated as decorative) --- CRM/PCP/Page/PCPInfo.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/CRM/PCP/Page/PCPInfo.php b/CRM/PCP/Page/PCPInfo.php index 8c0c76081d..2a3cf3762e 100644 --- a/CRM/PCP/Page/PCPInfo.php +++ b/CRM/PCP/Page/PCPInfo.php @@ -185,10 +185,11 @@ class CRM_PCP_Page_PCPInfo extends CRM_Core_Page { if (!empty($entityFile)) { $fileInfo = reset($entityFile); $fileId = $fileInfo['fileID']; + $altText = htmlspecialchars($fileInfo['description'] ?? ''); $fileHash = CRM_Core_BAO_File::generateFileHash($this->_id, $fileId); $image = '_id}&fcs={$fileHash}" - ) . '" />'; + ) . '" alt="' . $altText . '"/>'; $this->assign('image', $image); } -- 2.25.1