function theme_filefield_icon in FileField 5
Same name and namespace in other branches
- 5.2 filefield.module \theme_filefield_icon()
- 6.3 filefield.theme.inc \theme_filefield_icon()
- 6.2 filefield.theme.inc \theme_filefield_icon()
1 theme call to theme_filefield_icon()
File
- ./
filefield.module, line 470 - Defines a file field type.
Code
function theme_filefield_icon($file) {
$ext = array_pop(explode('.', $file['filename']));
$known_extensions = array(
'0',
'ace',
'aif',
'ai',
'ani',
'asf',
'asp',
'avi',
'bak',
'bat',
'bin',
'bmp',
'bz2',
'bz',
'cab',
'cdr',
'cfg',
'com',
'conf',
'cpt',
'css',
'cur',
'dat',
'db',
'dcr',
'dic',
'diff',
'dir',
'dll',
'dmg',
'doc',
'dwg',
'edir',
'eml',
'eps',
'exe',
'fla',
'flv',
'fon',
'gif',
'gz',
'hqx',
'html',
'htm',
'ico',
'inc',
'ini',
'iso',
'jpeg',
'jpg',
'js',
'lnk',
'log',
'm3u',
'mdb',
'midi',
'mid',
'mov',
'mp3',
'mpeg',
'mpg',
'nfo',
'odb',
'odc',
'odf',
'odg',
'odm',
'odp',
'ods',
'odt',
'ogg',
'otg',
'oth',
'otp',
'ots',
'ott',
'patch',
'pdf',
'php3',
'php',
'phtml',
'pl',
'png',
'pps',
'ppt',
'psd',
'pwl',
'qt',
'ram',
'ra',
'rar',
'reg',
'rpm',
'rtf',
'sh',
'shtml',
'sit',
'sql',
'svg',
'swf',
'sxc',
'sxi',
'sxw',
'sys',
'tar',
'tgz',
'tiff',
'tif',
'tmp',
'tpl',
'ttf',
'txt',
'wav',
'wma',
'wmv',
'wp',
'xls',
'xml',
'zip',
);
if (!in_array($ext, $known_extensions)) {
$ext = 0;
}
$imagepath = drupal_get_path('module', 'filefield') . '/ico/' . $ext . '.png';
return '<div class="filefield-icon-container"><div class="filefield-icon field-icon-' . $ext . '"><img src="' . $imagepath . '" /></div></div>';
//return '<div class="filefield-icon-container"><div class="filefield-icon field-icon-'. $ext .'"> </div></div>'."\n";
}