diff --git a/modules/file/file.module b/modules/file/file.module
index 7fc2980..3a2beed 100644
--- a/modules/file/file.module
+++ b/modules/file/file.module
@@ -92,7 +92,7 @@ function file_theme() {
'variables' => array('file' => NULL, 'icon_directory' => NULL),
),
'file_icon' => array(
- 'variables' => array('file' => NULL, 'icon_directory' => NULL),
+ 'variables' => array('file' => NULL, 'icon_directory' => NULL, 'alt' => ''),
),
'file_managed_file' => array(
'render element' => 'element',
@@ -754,10 +754,12 @@ function theme_file_link($variables) {
'application/octet-stream' => t('Binary Data'),
);
+ $mimetype = file_get_mimetype($file->filename);
+
$icon = theme('file_icon', array(
'file' => $file,
'icon_directory' => $icon_directory,
- 'alt' => (!empty($mime_name[file_get_mimetype($file->filename)])) ? $mime_name[file_get_mimetype($file->filename)] : t('File'),
+ 'alt' => !empty($mime_name[$mimetype]) ? $mime_name[$mimetype] : t('File'),
));
// Set options as per anchor format described at
@@ -788,6 +790,8 @@ function theme_file_link($variables) {
* - file: A file object for which to make an icon.
* - icon_directory: (optional) A path to a directory of icons to be used for
* files. Defaults to the value of the "file_icon_directory" variable.
+ * - alt: (optional) The alternative text to represent the icon in text-based
+ * browsers. Defaults to an empty string.
*
* @ingroup themeable
*/
@@ -798,7 +802,7 @@ function theme_file_icon($variables) {
$mime = check_plain($file->filemime);
$icon_url = file_icon_url($file, $icon_directory);
- return '';
+ return '';
}
/**