function theme_filefield_icon in FileField 6.2
Same name and namespace in other branches
- 5.2 filefield.module \theme_filefield_icon()
- 5 filefield.module \theme_filefield_icon()
- 6.3 filefield.theme.inc \theme_filefield_icon()
Return an image with an appropriate icon for the given file. Remember to pass a file object and not an array.
2 theme calls to theme_filefield_icon()
- filefield_generic_edit_process in ./
filefield.module - The 'process' callback for 'filefield_generic_edit' form elements. Called after defining the form and while building it, transforms the barebone element array into an icon and and a text field for editing the file description.
- theme_filefield_file_formatter_generic in ./
filefield.formatter.inc - Theme function for the 'generic' single file formatter.
File
- ./
filefield.theme.inc, line 71 - FileField: Defines a CCK file field type.
Code
function theme_filefield_icon($file) {
if (is_object($file)) {
$file = (array) $file;
}
$dashed_mime = check_plain(strtr($file['filemime'], array(
'/' => '-',
)));
if ($icon_url = _filefield_icon_url($file)) {
$icon = '<img class="field-icon-' . $dashed_mime . '" src="' . $icon_url . '" />';
}
return '<div class="filefield-icon field-icon-' . $dashed_mime . '">' . $icon . '</div>';
}