-
Notifications
You must be signed in to change notification settings - Fork 14
/
Copy pathfile_entity.theme.inc
38 lines (32 loc) · 1009 Bytes
/
file_entity.theme.inc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
<?php
/**
* @file
* Theme callbacks for the file entity module.
*/
/**
* Copy of theme_file_file_link() for linking to the view file page.
*
* @see theme_file_file_link()
*/
function theme_file_entity_file_link($variables) {
$file = $variables['file'];
$icon_directory = $variables['icon_directory'];
$url = 'file/' . $file->fid;
$icon = theme('file_icon', array('file' => $file, 'icon_directory' => $icon_directory));
// Set options as per anchor format described at
// http://microformats.org/wiki/file-format-examples
$options = array(
'attributes' => array(
'type' => $file->filemime . '; length=' . $file->filesize,
),
);
// Use the description as the link text if available.
if (empty($file->description)) {
$link_text = $file->filename;
}
else {
$link_text = $file->description;
$options['attributes']['title'] = check_plain($file->filename);
}
return '<span class="file">' . $icon . ' ' . l($link_text, $url, $options) . '</span>';
}