diff --git a/video_embed_field.field.inc b/video_embed_field.field.inc index cd42fb2..6237394 100644 --- a/video_embed_field.field.inc +++ b/video_embed_field.field.inc @@ -439,9 +439,11 @@ function video_embed_field_field_formatter_view($entity_type, $entity, $field, $ '#markup' => $item['description'], '#suffix' => '', ); + $alt = $item['description']; } else { $description = array(); + $alt = ''; } // Render the field. @@ -478,7 +480,7 @@ function video_embed_field_field_formatter_view($entity_type, $entity, $field, $ $element[$delta] = array( '#theme' => 'image_formatter', - '#item' => array('uri' => $item['thumbnail_path']), + '#item' => array('uri' => $item['thumbnail_path'], 'alt' => $alt), '#image_style' => $display['settings']['image_style'], '#path' => isset($path) ? $path : '', ); @@ -500,6 +502,7 @@ function video_embed_field_field_formatter_view($entity_type, $entity, $field, $ '#theme' => 'video_embed_field_colorbox_code', '#image_url' => $item['thumbnail_path'], '#image_style' => $display['settings']['image_style'], + '#image_alt' => $alt, '#video_url' => $item['video_url'], '#video_style' => $display['settings']['video_style'], '#video_data' => unserialize($item['video_data']), diff --git a/video_embed_field.module b/video_embed_field.module index c1db253..2e65ec6 100644 --- a/video_embed_field.module +++ b/video_embed_field.module @@ -129,6 +129,7 @@ function video_embed_field_theme() { 'variables' => array( 'image_url' => NULL, 'image_style' => 'normal', + 'image_alt' => NULL, 'video_url' => NULL, 'video_style' => NULL, 'video_data' => array(), @@ -433,6 +434,7 @@ function template_preprocess_video_embed_field_embed_code(&$variables) { * An associative array containing: * - image_url: The image URL. * - image_style: The image style to use. + * - image_alt: The image ALT attribute. * - video_url: The video URL. * - video_style: The video style to use. * - video_data: An array of data about the video. @@ -447,7 +449,7 @@ function theme_video_embed_field_colorbox_code($variables) { $image = array( '#theme' => 'image_formatter', - '#item' => array('uri' => $variables['image_url']), + '#item' => array('uri' => $variables['image_url'], 'alt' => $variables['image_alt']), '#image_style' => $variables['image_style'], '#path' => $path, );