From f9be2e37a1c07549b3af2fdd24048a61957c7db5 Mon Sep 17 00:00:00 2001 From: Tim Davison Date: Thu, 4 Apr 2019 08:32:45 -0700 Subject: [PATCH 1/2] Add accessible alt text --- templates/node----focus-on-teaser.tpl.php | 6 ++++++ templates/node----sidebar-teaser.tpl.php | 6 ++++++ templates/node----teaser.tpl.php | 6 ++++++ templates/node----vertical-teaser.tpl.php | 8 ++++++++ 4 files changed, 26 insertions(+) diff --git a/templates/node----focus-on-teaser.tpl.php b/templates/node----focus-on-teaser.tpl.php index f122506..679fdfa 100644 --- a/templates/node----focus-on-teaser.tpl.php +++ b/templates/node----focus-on-teaser.tpl.php @@ -21,6 +21,12 @@ $has_image = isset($content['field_image']); +if ($has_image && isset($url)): + if(isset($content['field_image'][0]['#item']) && empty($content['field_image'][0]['#item']['alt']) ): + $content['field_image'][0]['#item']['alt'] = $read_more . t(' at: ') . $title; + endif; +endif; + ?>
> diff --git a/templates/node----sidebar-teaser.tpl.php b/templates/node----sidebar-teaser.tpl.php index 4c46052..0924e1c 100644 --- a/templates/node----sidebar-teaser.tpl.php +++ b/templates/node----sidebar-teaser.tpl.php @@ -21,6 +21,12 @@ $has_image = isset($content['field_image']); +if ($has_image && isset($url)): + if(isset($content['field_image'][0]['#item']) && empty($content['field_image'][0]['#item']['alt']) ): + $content['field_image'][0]['#item']['alt'] = $read_more . t(' at: ') . $title; + endif; +endif; + ?>
> diff --git a/templates/node----teaser.tpl.php b/templates/node----teaser.tpl.php index a5a8fba..0ea3b18 100644 --- a/templates/node----teaser.tpl.php +++ b/templates/node----teaser.tpl.php @@ -25,6 +25,12 @@ $has_image = isset($content['field_image']); +if ($has_image && isset($url)): + if(isset($content['field_image'][0]['#item']) && empty($content['field_image'][0]['#item']['alt']) ): + $content['field_image'][0]['#item']['alt'] = $read_more . t(' at: ') . $title; + endif; +endif; + ?>
> diff --git a/templates/node----vertical-teaser.tpl.php b/templates/node----vertical-teaser.tpl.php index 594101d..e65d412 100644 --- a/templates/node----vertical-teaser.tpl.php +++ b/templates/node----vertical-teaser.tpl.php @@ -23,6 +23,14 @@ endif; endif; +$has_image = isset($content['field_image']); + +if ($has_image && isset($url)): + if(isset($content['field_image'][0]['#item']) && empty($content['field_image'][0]['#item']['alt']) ): + $content['field_image'][0]['#item']['alt'] = $read_more . t(' at: ') . $title; + endif; +endif; + ?>
> From c9b909616fb487a0b12577920a242e7df6a58b72 Mon Sep 17 00:00:00 2001 From: Tim Davison Date: Fri, 5 Apr 2019 03:28:57 -0700 Subject: [PATCH 2/2] Add changelog and up version number --- CHANGELOG.md | 15 +++++++++++++++ cambridge_teasers.info | 2 +- 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d8c4a27..6804f92 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,21 @@ Changelog for 7.x-1.* ===================== +7.x-1.6 +------- + +5 April 2019 + +* Add accessible alt text to teasers. + +7.x-1.5 +------- + +18 December 2018 + +* Allow horizontal and vertical teasers to have no link. +* Avoid warnings by checking that '#formatter is set before using it. + 7.x-1.4 ------- diff --git a/cambridge_teasers.info b/cambridge_teasers.info index 7f5c586..2273499 100644 --- a/cambridge_teasers.info +++ b/cambridge_teasers.info @@ -2,7 +2,7 @@ name = Teasers description = Adds University of Cambridge theme teasers node view modes. core = 7.x package = University of Cambridge -version = 7.x-1.5 +version = 7.x-1.6 project = cambridge_teasers dependencies[] = cambridge_image_styles dependencies[] = features