Skip to content

Commit

Permalink
Merge pull request #18 from misd-service-development/accessible
Browse files Browse the repository at this point in the history
Add accessible alt text
  • Loading branch information
JeebsUK authored Apr 5, 2019
2 parents 2006c0e + c9b9096 commit 6fcbc8f
Show file tree
Hide file tree
Showing 6 changed files with 42 additions and 1 deletion.
15 changes: 15 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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
-------

Expand Down
2 changes: 1 addition & 1 deletion cambridge_teasers.info
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 6 additions & 0 deletions templates/node----focus-on-teaser.tpl.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;

?>

<div class="campl-content-container campl-side-padding <?php print $classes; ?>" <?php print $attributes; ?>>
Expand Down
6 changes: 6 additions & 0 deletions templates/node----sidebar-teaser.tpl.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;

?>

<div class="campl-content-container <?php print $classes; ?>" <?php print $attributes; ?>>
Expand Down
6 changes: 6 additions & 0 deletions templates/node----teaser.tpl.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;

?>

<div class="campl-content-container campl-vertical-padding <?php print $classes; ?>" <?php print $attributes; ?>>
Expand Down
8 changes: 8 additions & 0 deletions templates/node----vertical-teaser.tpl.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;

?>

<div class="campl-content-container campl-vertical-padding <?php print $classes; ?>" <?php print $attributes; ?>>
Expand Down

0 comments on commit 6fcbc8f

Please sign in to comment.