function theme_media_gallery_item in Media Gallery 7.2
Same name and namespace in other branches
- 7 media_gallery.theme.inc \theme_media_gallery_item()
Theme the thumbnail link for a media gallery item
Parameters
string $image: Which meta data fields to display
string $link_path: The location to place the meta data on the media item
string $classes: An array of classes to attach to the link.
4 theme calls to theme_media_gallery_item()
- template_preprocess_media_gallery_media_item_thumbnail in ./
media_gallery.theme.inc - Template preprocess function for displaying a media item (entity) as a thumbnail on the gallery page.
- theme_media_gallery_block_thumbnail in ./
media_gallery.theme.inc - Displays a media item (entity) as a thumbnail in a block
- theme_media_gallery_media_item_lightbox in ./
media_gallery.theme.inc - Displays a media item (entity) within a lightbox.
- theme_media_gallery_teaser in ./
media_gallery.theme.inc - Displays a gallery node as a teaser.
File
- ./
media_gallery.theme.inc, line 418 - Media Gallery Theming
Code
function theme_media_gallery_item($variables) {
$image = $variables['image'];
$link_path = $variables['link_path'];
$attributes = array();
if (!empty($variables['classes'])) {
$attributes['class'] = $variables['classes'];
}
if (!empty($variables['title'])) {
// I'm fairly sure I don't like this solution. But as Alex mentions in
// theme_media_gallery_file_field_inline() the File Styles module isn't allowing
// us access to the render array pre-rendering, so I'm doing a str_replace()
// here specifically to address the title and alt for thumbnails. This had
// to be further modified to remove and then add the title and alt attributes
// video thumbnails had no title and alt attributes so the string replace was
// not triggering for them.
$new_image = str_replace(array(
'title=""',
'alt=""',
), array(
'',
'',
), $image);
$image = str_replace('/>', ' title="' . $variables['title'] . '" alt="' . $variables['title'] . '" />', $new_image);
}
// Add sliding door top div and wrappers
$item = '<div class="media-gallery-item"><div class="top"><div class="top-inset-1"><div class="top-inset-2"></div></div></div><div class="gallery-thumb-outer"><div class="gallery-thumb-inner">';
// Create a link around the image
$item .= empty($variables['no_link']) ? l($image, $link_path, array(
'html' => TRUE,
'attributes' => $attributes,
)) : $image;
// Add sliding door bottom div and close wrappers
$item .= '</div></div><div class="bottom"><div class="bottom-inset-1"><div class="bottom-inset-2"></div></div></div></div>';
return $item;
}