Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
project
drupal
Commits
36da783d
Commit
36da783d
authored
Aug 02, 2010
by
Dries
Browse files
- Patch
#650732
by aaron: add icon_directory() to theme_file_icon().
parent
6f055df1
Changes
1
Hide whitespace changes
Inline
Side-by-side
modules/file/file.module
View file @
36da783d
...
...
@@ -88,10 +88,10 @@ function file_theme() {
return
array
(
// file.module.
'file_link'
=>
array
(
'variables'
=>
array
(
'file'
=>
NULL
),
'variables'
=>
array
(
'file'
=>
NULL
,
'icon_directory'
=>
NULL
),
),
'file_icon'
=>
array
(
'variables'
=>
array
(
'file'
=>
NULL
),
'variables'
=>
array
(
'file'
=>
NULL
,
'icon_directory'
=>
NULL
),
),
'file_managed_file'
=>
array
(
'render element'
=>
'element'
,
...
...
@@ -681,14 +681,17 @@ function file_managed_file_pre_render($element) {
* @param $variables
* An associative array containing:
* - file: A file object to which the link will be created.
* - 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.
*
* @ingroup themeable
*/
function
theme_file_link
(
$variables
)
{
$file
=
$variables
[
'file'
];
$icon_directory
=
$variables
[
'icon_directory'
];
$url
=
file_create_url
(
$file
->
uri
);
$icon
=
theme
(
'file_icon'
,
array
(
'file'
=>
$file
));
$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
...
...
@@ -716,14 +719,17 @@ function theme_file_link($variables) {
* @param $variables
* An associative array containing:
* - 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.
*
* @ingroup themeable
*/
function
theme_file_icon
(
$variables
)
{
$file
=
$variables
[
'file'
];
$icon_directory
=
$variables
[
'icon_directory'
];
$mime
=
check_plain
(
$file
->
filemime
);
$icon_url
=
file_icon_url
(
$file
);
$icon_url
=
file_icon_url
(
$file
,
$icon_directory
);
return
'<img class="file-icon" alt="" title="'
.
$mime
.
'" src="'
.
$icon_url
.
'" />'
;
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment