You are here

function theme_media_formatter_large_icon in D7 Media 7.3

Same name and namespace in other branches
  1. 7.4 includes/media.theme.inc \theme_media_formatter_large_icon()
  2. 7 includes/media.theme.inc \theme_media_formatter_large_icon()
  3. 7.2 includes/media.theme.inc \theme_media_formatter_large_icon()

Field formatter for displaying a file as a large icon.

1 theme call to theme_media_formatter_large_icon()
media_field_formatter_view in includes/media.fields.inc
Implements hook_field_formatter_view().

File

includes/media.theme.inc, line 71
Media Theming.

Code

function theme_media_formatter_large_icon($variables) {
  $file = $variables['file'];
  $icon_dir = variable_get('media_icon_base_directory', 'public://media-icons') . '/' . variable_get('media_icon_set', 'default');
  $icon = file_icon_path($file, $icon_dir);
  $variables['path'] = $icon;

  // theme_image() requires the 'alt' attribute passed as its own variable.
  // @see http://drupal.org/node/999338
  if (!isset($variables['alt']) && isset($variables['attributes']['alt'])) {
    $variables['alt'] = $variables['attributes']['alt'];
  }

  // Add image height and width for the image theme functions.
  if ($info = image_get_info($icon)) {
    $variables += $info;
  }
  if ($variables['style_name']) {
    $output = theme('image_style', $variables);
  }
  else {
    $output = theme('image', $variables);
  }
  return $output;
}