[BUGFIX] skip missing icons in tceforms select options
authorPeter Niederlag(office) <netservice@niekom.de>
Wed, 28 Sep 2011 07:55:32 +0000 (09:55 +0200)
committerXavier Perseguers <xavier@typo3.org>
Mon, 17 Oct 2011 08:29:31 +0000 (10:29 +0200)
check existance of file before adding background style url

Change-Id: Ie5db6d6a6b6b7ccdd5772a829be0ca236787cd9a
Fixes: #24591
Releases: 4.5, 4.6
Reviewed-on: http://review.typo3.org/5394
Reviewed-by: Björn Pedersen
Reviewed-by: Markus Klein
Tested-by: Markus Klein
Reviewed-by: Philipp Gampe
Reviewed-by: Stefan Neufeind
Reviewed-by: Xavier Perseguers
Tested-by: Xavier Perseguers
t3lib/class.t3lib_tceforms.php

index ec26bce..8f63e31 100644 (file)
@@ -4064,6 +4064,9 @@ class t3lib_TCEforms {
                        $iconPath = substr($selIconFile, strlen($this->backPath));
                        $selIconInfo = @getimagesize(PATH_typo3 . $iconPath);
                }
+               if ($selIconInfo === FALSE) {
+                       $selIconFile = ''; // unset to empty string if icon is not available
+               }
                return array($selIconFile, $selIconInfo);
        }
 
@@ -4092,7 +4095,9 @@ class t3lib_TCEforms {
        function optionTagStyle($iconString) {
                if ($iconString) {
                        list($selIconFile, $selIconInfo) = $this->getIcon($iconString);
-
+                       if (empty($selIconFile))  {
+                               return ''; // skip background style if image is unavailable
+                       }
                        $padLeft = $selIconInfo[0] + 4;
 
                        if ($padLeft >= 18 && $padLeft <= 24) {
@@ -4114,7 +4119,9 @@ class t3lib_TCEforms {
        function optgroupTagStyle($iconString) {
                if ($iconString) {
                        list($selIconFile, $selIconInfo) = $this->getIcon($iconString);
-
+                       if (empty($selIconFile)) {
+                               return ''; // skip background style if image is unavailable
+                       }
                        $padLeft = $selIconInfo[0] + 4;
 
                        if($padLeft >= 18 && $padLeft <= 24) {