function theme_video_formatter_thumbnail in Video 7.2
Renders the video thumbnail as a link to the node page.
1 theme call to theme_video_formatter_thumbnail()
- video_field_formatter_view in ./
video.field.inc - Implements hook_field_formatter_view().
File
- ./
video.theme.inc, line 107 - Theme related functions for the Video module.
Code
function theme_video_formatter_thumbnail($variables) {
$item = $variables['item'];
// Inside a view $variables may contain null data. In that case, just return.
if (empty($item['fid']) || empty($item['thumbnailfile'])) {
return '';
}
$thumbnail = $item['thumbnailfile'];
$title = isset($variables['entity']->title) ? $variables['entity']->title : '';
$image = array(
'path' => $thumbnail->uri,
'alt' => $title,
);
// Do not output an empty 'title' attribute.
if (!empty($title)) {
$image['title'] = $title;
}
if (!empty($variables['image_style'])) {
$image['style_name'] = $variables['image_style'];
$output = theme('image_style', $image);
}
else {
$output = theme('image', $image);
}
if ($variables['path']) {
$path = $variables['path']['path'];
$options = $variables['path']['options'];
// When displaying an image inside a link, the html option must be TRUE.
$options['html'] = TRUE;
if (!empty($variables['colorbox'])) {
$options['attributes'] = array(
'class' => array(
'colorbox-load',
),
);
}
$output = l($output, $path, $options);
}
return $output;
}