[BUGFIX] Show thumbnails in list module 50/28350/2
authorMarkus Klein <klein.t3@mfc-linz.at>
Thu, 13 Mar 2014 11:28:55 +0000 (12:28 +0100)
committerMarkus Klein <klein.t3@mfc-linz.at>
Thu, 13 Mar 2014 15:19:40 +0000 (16:19 +0100)
Add missing checks if type column exists in a row.

Resolves: #56830
Releases: 6.2, 6.1
Change-Id: Ifafdb0c51266c76620696c6d94471b3efddba112
Reviewed-on: https://review.typo3.org/28350
Reviewed-by: Markus Klein
Tested-by: Markus Klein
typo3/sysext/recordlist/Classes/RecordList/DatabaseRecordList.php

index c2abf3d..70e7181 100644 (file)
@@ -636,8 +636,15 @@ class DatabaseRecordList extends \TYPO3\CMS\Recordlist\RecordList\AbstractDataba
                                        // - a thumbnail column exists
                                        // - there is content in it
                                        // - the thumbnail column is visible for the current type
-                                       $typeColumn = $GLOBALS['TCA'][$table]['ctrl']['type'];
-                                       $type = $row[$typeColumn];
+                                       $type = 0;
+                                       if (isset($GLOBALS['TCA'][$table]['ctrl']['type'])) {
+                                               $typeColumn = $GLOBALS['TCA'][$table]['ctrl']['type'];
+                                               $type = $row[$typeColumn];
+                                       }
+                                       // If current type doesn't exist, set it to 0 (or to 1 for historical reasons, if 0 doesn't exist)
+                                       if (!isset($GLOBALS['TCA'][$table]['types'][$type])) {
+                                               $type = isset($GLOBALS['TCA'][$table]['types'][0]) ? 0 : 1;
+                                       }
                                        $visibleColumns = $GLOBALS['TCA'][$table]['types'][$type]['showitem'];
 
                                        if ($this->thumbs &&