summaryrefslogtreecommitdiff
path: root/modules/file
diff options
context:
space:
mode:
authorDries Buytaert <dries@buytaert.net>2010-08-02 13:26:40 +0000
committerDries Buytaert <dries@buytaert.net>2010-08-02 13:26:40 +0000
commit36da783d5310d680d137ccaeb116691e35be424a (patch)
treebb4603f26d84cc73322c6fd49c1614359f4b148a /modules/file
parent6f055df1ed52cfbfc36516ce9a89061e8d8411b9 (diff)
downloadbrdo-36da783d5310d680d137ccaeb116691e35be424a.tar.gz
brdo-36da783d5310d680d137ccaeb116691e35be424a.tar.bz2
- Patch #650732 by aaron: add icon_directory() to theme_file_icon().
Diffstat (limited to 'modules/file')
-rw-r--r--modules/file/file.module14
1 files changed, 10 insertions, 4 deletions
diff --git a/modules/file/file.module b/modules/file/file.module
index 0ac0ec9f5..0340eb059 100644
--- a/modules/file/file.module
+++ b/modules/file/file.module
@@ -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 . '" />';
}