From 3d7be27d5fa6a11557ae9b4adb1cbc92ceac1fc7 Mon Sep 17 00:00:00 2001 From: Kim Nguyen Date: Wed, 18 Sep 2024 15:26:00 -0400 Subject: [PATCH 01/11] Provide alt text configuration options for images. * Within the Appearance Settings, users can select an element that can provide alt text for files. * Users can also write alt text via a new field on the file edit form. This field will override alt text provided by file metadata. * Images use a blank alt by default. * File markup no longer provides titles by default, nor populate titles using the alt attribute. * Browse views no longer assign "presentation" roles to the record images. --- admin/themes/default/collections/browse.php | 2 +- admin/themes/default/files/edit.php | 16 +++++++++++ admin/themes/default/files/show.php | 10 ++++++- admin/themes/default/items/browse.php | 2 +- application/forms/AppearanceSettings.php | 27 ++++++++++++++++++- .../20240917160000_addFileAltText.php | 20 ++++++++++++++ application/models/File.php | 21 +++++++++++++++ application/schema/files.sql | 1 + application/views/helpers/FileMarkup.php | 12 ++------- application/views/scripts/items/browse.php | 2 +- bootstrap.php | 2 +- 11 files changed, 99 insertions(+), 16 deletions(-) create mode 100644 application/migrations/20240917160000_addFileAltText.php diff --git a/admin/themes/default/collections/browse.php b/admin/themes/default/collections/browse.php index 2dc59b3eca..336f5fcb47 100644 --- a/admin/themes/default/collections/browse.php +++ b/admin/themes/default/collections/browse.php @@ -42,7 +42,7 @@ - 'presentation'))): ?> + 'image')); ?> diff --git a/admin/themes/default/files/edit.php b/admin/themes/default/files/edit.php index 983d14ce87..c94863b606 100644 --- a/admin/themes/default/files/edit.php +++ b/admin/themes/default/files/edit.php @@ -37,6 +37,22 @@ 'big red button delete-confirm')); ?> $this, 'record'=>$file)); ?> +
+ formLabel('collection-id', __('Alt Text'));?> +
+

+ formTextarea( + 'alt_text', + $file->alt_text, + array( + 'id' => 'file-alt-text', + 'rows' => '5' + ) + ); + ?> +
+
$this, 'record'=>$file)); ?> diff --git a/admin/themes/default/files/show.php b/admin/themes/default/files/show.php index 8ac6b321a4..b1ba67408a 100644 --- a/admin/themes/default/files/show.php +++ b/admin/themes/default/files/show.php @@ -31,11 +31,19 @@ -
+

getItem()); ?>

+
+

+

+ getAltText(); ?> +

+
+ +