function theme_emaudio_audio_thumbnail in Embedded Media Field 6
Same name and namespace in other branches
- 6.3 contrib/emaudio/emaudio.theme.inc \theme_emaudio_audio_thumbnail()
- 6.2 contrib/emaudio/emaudio.theme.inc \theme_emaudio_audio_thumbnail()
File
- contrib/emaudio/emaudio.theme.inc, line 24
- This defines the various theme functions for Embedded Audio Field (emaudio).
Code
function theme_emaudio_audio_thumbnail($field, $item, $formatter, $node, $no_link = FALSE, $options = array()) {
if ($item['value'] && $item['provider']) {
$thumbnail_url = $options['thumbnail_url'] ? $options['thumbnail_url'] : module_invoke('emthumb', 'thumbnail_url', $item);
$thumbnail_url = $thumbnail_url ? $thumbnail_url : module_invoke('emfield', 'include_invoke', 'emaudio', $item['provider'], 'thumbnail', $field, $item, $formatter, $node, $width, $height, $options);
if (!$thumbnail_url) {
$default_thumbnail_url = $field['widget']['thumbnail_default_path'] ? $field['widget']['thumbnail_default_path'] : variable_get('emaudio_default_thumbnail_path', NULL);
if ($default_thumbnail_url) {
$thumbnail_url = base_path() . $default_thumbnail_url;
}
}
}
else {
if (!$thumbnail_url) {
$default_thumbnail_url = $field['widget']['thumbnail_default_path'] ? $field['widget']['thumbnail_default_path'] : variable_get('emaudio_default_thumbnail_path', NULL);
if ($default_thumbnail_url) {
$thumbnail_url = base_path() . $default_thumbnail_url;
}
}
}
$link_url = isset($options['link_url']) ? $options['link_url'] : 'node/' . $node->nid;
$link_title = isset($options['link_title']) ? $options['link_title'] : t('See audio');
$image_title = isset($options['image_title']) ? $options['image_title'] : $link_title;
$image_alt = isset($options['image_alt']) ? $options['image_alt'] : $link_title;
if ($thumbnail_url) {
$width = isset($options['width']) ? $options['width'] : NULL;
$width = isset($width) ? $width : ($field['widget']['thumbnail_width'] ? $field['widget']['thumbnail_width'] : variable_get('emaudio_default_thumbnail_width', EMAUDIO_DEFAULT_THUMBNAIL_WIDTH));
$height = isset($options['height']) ? $options['height'] : NULL;
$height = isset($height) ? $height : ($field['widget']['thumbnail_height'] ? $field['widget']['thumbnail_height'] : variable_get('emaudio_default_thumbnail_height', emaudio_DEFAULT_THUMBNAIL_HEIGHT));
if ($no_link) {
$output = '<img src="' . $thumbnail_url . '" width="' . $width . '" height="' . $height . '" alt="' . $image_alt . '" title="' . $image_title . '" />';
}
else {
$output = l('<img src="' . $thumbnail_url . '" width="' . $width . '" height="' . $height . '" alt="' . $image_alt . '" title="' . $image_title . '" />', $link_url, array(
'html' => true,
));
}
}
else {
if ($no_link) {
$output = '';
}
else {
$output = l($link_title, $link_url);
}
}
return $output;
}