You are here

function theme_filefield_icon in FileField 6.3

Same name and namespace in other branches
  1. 5.2 filefield.module \theme_filefield_icon()
  2. 5 filefield.module \theme_filefield_icon()
  3. 6.2 filefield.theme.inc \theme_filefield_icon()

Return an image with an appropriate icon for the given file.

Parameters

$file: A file object for which to make an icon.

2 theme calls to theme_filefield_icon()
filefield_handler_field_icon::render in views/filefield_handler_field_icon.inc
theme_filefield_file in ./filefield_formatter.inc
Theme function for the 'generic' single file formatter.

File

./filefield.theme.inc, line 17
Theme functions used for normal file output.

Code

function theme_filefield_icon($file) {
  if (is_object($file)) {
    $file = (array) $file;
  }
  $mime = check_plain($file['filemime']);
  $dashed_mime = strtr($mime, array(
    '/' => '-',
    '+' => '-',
    '.' => '-',
  ));
  if ($icon_url = filefield_icon_url($file)) {
    return '<img class="filefield-icon field-icon-' . $dashed_mime . '"  alt="' . t('@mime icon', array(
      '@mime' => $mime,
    )) . '" src="' . $icon_url . '" />';
  }
}