Fixed bug #14466: Bug: SpriteIconApi getSpriteIconForRecord does not find default...
authorSteffen Kamper <info@sk-typo3.de>
Wed, 26 May 2010 00:07:43 +0000 (00:07 +0000)
committerSteffen Kamper <info@sk-typo3.de>
Wed, 26 May 2010 00:07:43 +0000 (00:07 +0000)
git-svn-id: https://svn.typo3.org/TYPO3v4/Core/trunk@7675 709f56b5-9817-0410-a4d7-c38de5d9e867

ChangeLog
t3lib/class.t3lib_iconworks.php

index 025fedf..e43fe27 100755 (executable)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,6 @@
 2010-05-26  Steffen Kamper  <info@sk-typo3.de>
 
+       * Fixed bug #14466: Bug: SpriteIconApi getSpriteIconForRecord does not find default icon (thanks to Steffen Ritter)
        * Follow-up to bug #13379: Sprite Icon API (thanks to Steffen Ritter)
        * Follow-up to bug #14324: Feature: Add spriteGeneratorAPI to support the new sprite-icon-api (thanks to Steffen Ritter)
 
index 2c0b96c..edd0437 100644 (file)
@@ -777,7 +777,11 @@ final class t3lib_iconWorks        {
                if (isset($GLOBALS['TCA'][$table]['ctrl']['typeicon_column'])) {
                        $column = $GLOBALS['TCA'][$table]['ctrl']['typeicon_column'];
 
-                       $recordType = $row[$column];
+                       if(isset($row[$column])) {
+                               $recordType = $row[$column];
+                       } else {
+                               $recordType = 'default';
+                       }
 
                                // workaround to give nav_hide pages a complete different icon
                                // although it's not a separate doctype
@@ -785,17 +789,28 @@ final class t3lib_iconWorks       {
                                $recordType .= '-hideinmenu';
                        }
 
-                       $iconName = $GLOBALS['TCA'][$table]['ctrl']['typeicon_classes'][$recordType];
-                       if (!$iconName && in_array('tcarecords-' . $table . '-' . $recordType, $GLOBALS['TBE_STYLES']['spriteIconApi']['iconsAvailable'])) {
-                               $iconName = 'tcarecords-' . $table . '-' . $recordType;
+                       if(is_array($GLOBALS['TCA'][$table]['ctrl']['typeicon_classes'])) {
+                               if(isset($GLOBALS['TCA'][$table]['ctrl']['typeicon_classes'][$recordType])) {
+                                       $iconName = $GLOBALS['TCA'][$table]['ctrl']['typeicon_classes'][$recordType];
+                               } else {
+                                       $iconName = $GLOBALS['TCA'][$table]['ctrl']['typeicon_classes']['default'];
+                               }
+                               
+                       } else {
+                               if (in_array('tcarecords-' . $table . '-' . $recordType, $GLOBALS['TBE_STYLES']['spriteIconApi']['iconsAvailable'])) {
+                                       $iconName = 'tcarecords-' . $table . '-' . $recordType;
+                               } else {
+                                       $iconName = $iconName = 'tcarecords-' . $table . '-default';
+                               }
                        }
                } else {
-                       $iconName = $GLOBALS['TCA'][$table]['ctrl']['typeicon_classes'][0];
-                       if (!$iconName && in_array('tcarecords-' . $table . '-default', $GLOBALS['TBE_STYLES']['spriteIconApi']['iconsAvailable'])) {
+                       if(is_array($GLOBALS['TCA'][$table]['ctrl']['typeicon_classes'])) {
+                               $iconName = $GLOBALS['TCA'][$table]['ctrl']['typeicon_classes']['default'];
+                       } else if (in_array('tcarecords-' . $table . '-default', $GLOBALS['TBE_STYLES']['spriteIconApi']['iconsAvailable'])) {
                                $iconName = 'tcarecords-' . $table . '-default';
                        }
                }
-               return self::getSpriteIconClasses(($iconName ? $iconName : 'status-status-icon-missing'));
+               return self::getSpriteIconClasses(($iconName != '' ? $iconName : 'status-status-icon-missing'));
        }