[FEATURE] Make filelinks icons configurable
authorLorenz Ulrich <lorenz.ulrich@visol.ch>
Sat, 30 Jul 2011 23:40:43 +0000 (01:40 +0200)
committerSteffen Ritter <info@rs-websystems.de>
Mon, 28 Nov 2011 14:01:52 +0000 (15:01 +0100)
The changeset introduces new Typoscript properties for setting the path
to the filetype icons, the extension of the filetype icons and
the width and height attribute of the img tag when using
the Filelinks/"uploads" cObject.

If no special configuration is set, the old defaults are taken (icons
from tslib/media/fileicons/, extension gif, width 18, height 16).

New sub properties of filelink.icon:
* path : path to icon set (default: tslib/media/fileicons/)
* ext : extension of icons (default: gif)
* widthAttribute : width of icons (default: 18)
* heightAttribute : height of icons (default: 16)

Change-Id: I69781a5ece9ff32ae51220e669b0c740638f5329
Resolves: #23624
Releases: 4.7
Reviewed-on: http://review.typo3.org/3921
Reviewed-by: Markus Klein
Reviewed-by: Philipp Gampe
Tested-by: Philipp Gampe
Reviewed-by: Lorenz Ulrich
Tested-by: Lorenz Ulrich
Reviewed-by: Simon Schaufelberger
Tested-by: Simon Schaufelberger
Reviewed-by: Stefan Neufeind
Reviewed-by: Steffen Ritter
Tested-by: Steffen Ritter
typo3/sysext/cms/tslib/class.tslib_content.php

index 24613b9..d06cdc9 100644 (file)
@@ -3952,8 +3952,15 @@ class tslib_cObj {
                        $theSize = filesize($theFile);
                        $fI = t3lib_div::split_fileref($theFile);
                        if ($conf['icon']) {
-                               $iconP = t3lib_extMgm::siteRelPath('cms') . 'tslib/media/fileicons/';
-                               $icon = @is_file($iconP . $fI['fileext'] . '.gif') ? $iconP . $fI['fileext'] . '.gif' : $iconP . 'default.gif';
+                               $conf['icon.']['path'] = isset($conf['icon.']['path.'])
+                                       ? $this->stdWrap($conf['icon.']['path'], $conf['icon.']['path.'])
+                                       : $conf['icon.']['path'];
+                               $iconP = !empty($conf['icon.']['path']) ? $conf['icon.']['path'] : t3lib_extMgm::siteRelPath('cms') . 'tslib/media/fileicons/';
+                               $conf['icon.']['ext'] = isset($conf['icon.']['ext.'])
+                                       ? $this->stdWrap($conf['icon.']['ext'], $conf['icon.']['ext.'])
+                                       : $conf['icon.']['ext'];
+                               $iconExt = !empty($conf['icon.']['ext']) ? '.' . $conf['icon.']['ext'] : '.gif';
+                               $icon = @is_file($iconP . $fI['fileext'] . $iconExt) ? $iconP . $fI['fileext'] . $iconExt : $iconP . 'default' . $iconExt;
                                        // Checking for images: If image, then return link to thumbnail.
                                $IEList = isset($conf['icon_image_ext_list.'])
                                        ? $this->stdWrap($conf['icon_image_ext_list'], $conf['icon_image_ext_list.'])
@@ -3981,8 +3988,16 @@ class tslib_cObj {
                                                        $this->getBorderAttr(' border="0"') . '' . $this->getAltParam($conf) . ' />';
                                        }
                                } else {
+                                       $conf['icon.']['widthAttribute'] = isset($conf['icon.']['widthAttribute.'])
+                                               ? $this->stdWrap($conf['icon.']['widthAttribute'], $conf['icon.']['widthAttribute.'])
+                                               : $conf['icon.']['widthAttribute'];
+                                       $iconWidth = !empty($conf['icon.']['widthAttribute']) ? $conf['icon.']['widthAttribute'] : 18;
+                                       $conf['icon.']['heightAttribute'] = isset($conf['icon.']['heightAttribute.'])
+                                               ? $this->stdWrap($conf['icon.']['heightAttribute'], $conf['icon.']['heightAttribute.'])
+                                               : $conf['icon.']['heightAttribute'];
+                                       $iconHeight = !empty($conf['icon.']['heightAttribute']) ? $conf['icon.']['heightAttribute'] : 16;
                                        $icon = '<img src="' . htmlspecialchars($GLOBALS['TSFE']->absRefPrefix . $icon) .
-                                               '" width="18" height="16"' . $this->getBorderAttr(' border="0"') .
+                                               '" width="' . $iconWidth . '" height="' . $iconHeight . '"' . $this->getBorderAttr(' border="0"') .
                                                $this->getAltParam($conf) . ' />';
                                }
                                if ($conf['icon_link']) {