function theme_media_gallery_file_field_inline in Media Gallery 7
Same name and namespace in other branches
- 7.2 media_gallery.theme.inc \theme_media_gallery_file_field_inline()
Renders a file field for use where block-level HTML tags are not wanted, such as in a link.
This theme function is called instead of theme_field(), and therefore, we bypass all the container DIV tags normally added for fields.
2 theme calls to theme_media_gallery_file_field_inline()
- 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
File
- ./
media_gallery.theme.inc, line 579 - Media Gallery Theming
Code
function theme_media_gallery_file_field_inline($variables) {
$element = $variables['element'];
$output = drupal_render_children($element);
// @todo Most likely, the image was rendered using a Styles module formatter
// (probably a File Styles wrapper to an image style). The Styles module
// needs to be improved to integrate properly into Drupal 7 rendering, so
// that we can adjust the render array before rendering it. But until the
// Styles module is sufficiently improved, we're stuck with getting back a
// rendered string containing a DIV wrapper around the image. So here, we
// remove all DIV tags, which is totally hacky, and exactly the kind of
// stuff that the D7 render system is meant to avoid.
$output = trim(preg_replace('@</?div.*?/?\\>@', '', $output));
return $output;
}