Révision 59ae487e
Ajouté par Assos Assos il y a presque 7 ans
drupal7/sites/all/modules/file_entity/file_entity.theme.inc | ||
---|---|---|
12 | 12 |
*/ |
13 | 13 |
function theme_file_entity_file_link($variables) { |
14 | 14 |
$file = $variables['file']; |
15 |
$icon_directory = $variables['icon_directory']; |
|
15 |
$uri = entity_uri('file', $file); |
|
16 |
|
|
17 |
// Human-readable names, for use as text-alternatives to icons. |
|
18 |
$mime_name = array( |
|
19 |
'application/msword' => t('Microsoft Office document icon'), |
|
20 |
'application/vnd.ms-excel' => t('Office spreadsheet icon'), |
|
21 |
'application/vnd.ms-powerpoint' => t('Office presentation icon'), |
|
22 |
'application/pdf' => t('PDF icon'), |
|
23 |
'video/quicktime' => t('Movie icon'), |
|
24 |
'audio/mpeg' => t('Audio icon'), |
|
25 |
'audio/wav' => t('Audio icon'), |
|
26 |
'image/jpeg' => t('Image icon'), |
|
27 |
'image/png' => t('Image icon'), |
|
28 |
'image/gif' => t('Image icon'), |
|
29 |
'application/zip' => t('Package icon'), |
|
30 |
'text/html' => t('HTML icon'), |
|
31 |
'text/plain' => t('Plain text icon'), |
|
32 |
'application/octet-stream' => t('Binary Data'), |
|
33 |
); |
|
34 |
|
|
35 |
$mimetype = file_get_mimetype($file->uri); |
|
16 | 36 |
|
17 |
$url = 'file/' . $file->fid; |
|
18 |
$icon = theme('file_icon', array('file' => $file, 'icon_directory' => $icon_directory)); |
|
37 |
$icon = theme('file_icon', array( |
|
38 |
'file' => $file, |
|
39 |
'icon_directory' => $variables['icon_directory'], |
|
40 |
'alt' => !empty($mime_name[$mimetype]) ? $mime_name[$mimetype] : t('File'), |
|
41 |
)); |
|
19 | 42 |
|
20 | 43 |
// Set options as per anchor format described at |
21 | 44 |
// http://microformats.org/wiki/file-format-examples |
22 |
$options = array( |
|
23 |
'attributes' => array( |
|
24 |
'type' => $file->filemime . '; length=' . $file->filesize, |
|
25 |
), |
|
26 |
); |
|
45 |
$uri['options']['attributes']['type'] = $file->filemime . '; length=' . $file->filesize; |
|
27 | 46 |
|
28 | 47 |
// Use the description as the link text if available. |
29 | 48 |
if (empty($file->description)) { |
... | ... | |
44 | 63 |
*/ |
45 | 64 |
function theme_file_entity_download_link($variables) { |
46 | 65 |
$file = $variables['file']; |
47 |
$icon_directory = $variables['icon_directory']; |
|
48 |
|
|
49 | 66 |
$uri = file_entity_download_uri($file); |
50 |
$icon = theme('file_icon', array('file' => $file, 'icon_directory' => $icon_directory)); |
|
67 |
|
|
68 |
// Human-readable names, for use as text-alternatives to icons. |
|
69 |
$mime_name = array( |
|
70 |
'application/msword' => t('Microsoft Office document icon'), |
|
71 |
'application/vnd.ms-excel' => t('Office spreadsheet icon'), |
|
72 |
'application/vnd.ms-powerpoint' => t('Office presentation icon'), |
|
73 |
'application/pdf' => t('PDF icon'), |
|
74 |
'video/quicktime' => t('Movie icon'), |
|
75 |
'audio/mpeg' => t('Audio icon'), |
|
76 |
'audio/wav' => t('Audio icon'), |
|
77 |
'image/jpeg' => t('Image icon'), |
|
78 |
'image/png' => t('Image icon'), |
|
79 |
'image/gif' => t('Image icon'), |
|
80 |
'application/zip' => t('Package icon'), |
|
81 |
'text/html' => t('HTML icon'), |
|
82 |
'text/plain' => t('Plain text icon'), |
|
83 |
'application/octet-stream' => t('Binary Data'), |
|
84 |
); |
|
85 |
|
|
86 |
$mimetype = file_get_mimetype($file->uri); |
|
87 |
|
|
88 |
$icon = theme('file_icon', array( |
|
89 |
'file' => $file, |
|
90 |
'icon_directory' => $variables['icon_directory'], |
|
91 |
'alt' => !empty($mime_name[$mimetype]) ? $mime_name[$mimetype] : t('File'), |
|
92 |
)); |
|
51 | 93 |
|
52 | 94 |
// Set options as per anchor format described at |
53 | 95 |
// http://microformats.org/wiki/file-format-examples |
Formats disponibles : Unified diff
Weekly update of contrib modules