function media_get_thumbnail_preview in D7 Media 7
Same name and namespace in other branches
- 7.4 media.module \media_get_thumbnail_preview()
- 7.2 media.module \media_get_thumbnail_preview()
- 7.3 media.module \media_get_thumbnail_preview()
Returns a renderable array with the necessary classes to support a media thumbnail. Also provides default fallback images if no image is available.
Parameters
$file:
Return value
array Renderable array.
4 calls to media_get_thumbnail_preview()
- media_admin_thumbnails in includes/
media.admin.inc - Form builder: Builds the media thumbnails administration overview.
- media_browser_build_media_item in includes/
media.browser.inc - Adds properties to the passed in file that are needed by the media browser JS code.
- media_element_process in ./
media.module - #process callback for the media form element.
- media_format_form in includes/
media.filter.inc - Form callback used when embedding media.
File
- ./
media.module, line 1085 - Media API
Code
function media_get_thumbnail_preview($file, $link = NULL) {
// If a file has an invalid type, allow file_view_file() to work.
if (!file_info_file_types($file->type)) {
$file->type = media_get_type($file);
}
$preview = file_view_file($file, 'media_preview');
$preview['#show_names'] = TRUE;
$preview['#add_link'] = $link;
$preview['#theme_wrappers'][] = 'media_thumbnail';
return $preview;
}