Commit 64f50c76 authored by guschilds's avatar guschilds

Issue #2051013 by guschilds: Added default alt attribute values to thumbnails.

parent 46de1a8c
......@@ -109,6 +109,7 @@ class YouTubeThumbFormatter extends FormatterBase {
$element[$delta] = array(
'#theme' => 'youtube_thumbnail',
'#video_id' => $item->video_id,
'#entity_title' => $items->getEntity()->getTitle(),
'#image_style' => $this->getSetting('image_style'),
'#image_link' => isset($url) ? $url : '',
);
......
......@@ -77,6 +77,7 @@ function youtube_theme($existing, $type, $theme, $path) {
'function' => 'theme_youtube_thumbnail',
'variables' => array(
'video_id' => NULL,
'entity_title' => NULL,
'image_style' => NULL,
'image_link' => NULL,
),
......@@ -213,18 +214,24 @@ function theme_youtube_thumbnail($variables) {
}
}
$alt = t('Embedded thumbnail for @entity_title', array(
'@entity_title' => $variables['entity_title'],
));
if ($style) {
$uri = 'public://' . $youtube_dir . '/' . $id . '.png';
$build = array(
'#theme' => 'image_style',
'#uri' => $uri,
'#style_name' => $style,
'#alt' => $alt,
);
} else {
$uri = 'public://' . $youtube_dir . '/' . $id . '.png';
$build['image'] = array(
'#theme' => 'image',
'#uri' => $uri,
'#alt' => $alt,
);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment