[BUGFIX] List module shows thumbs on CEs of type text 73/19573/2
authorMario Rimann <mario.rimann@typo3.org>
Wed, 20 Mar 2013 22:29:31 +0000 (23:29 +0100)
committerChristian Kuhn <lolli@schwarzbu.ch>
Fri, 5 Apr 2013 13:32:09 +0000 (15:32 +0200)
The list module renders a thumbnail for content elements as soon
as they have an image attached - independent of the current type
of the content element.

This patch changes the behavior, so that the thumbnail for
records in the list view are only shown, if the thumbnail-
column is visible for the current type.

Change-Id: Id59d7816f91bd37f49f794827826fca1929f7d0a
Resolves: #26753
Releases: 6.1, 6.0
Reviewed-on: https://review.typo3.org/19573
Reviewed-by: Christian Kuhn
Tested-by: Christian Kuhn
typo3/sysext/recordlist/Classes/RecordList/DatabaseRecordList.php

index 8eb24c3..144e023 100644 (file)
@@ -629,8 +629,18 @@ class DatabaseRecordList extends \TYPO3\CMS\Recordlist\RecordList\AbstractDataba
                                                $warning = '<a href="#" onclick="' . htmlspecialchars(('alert(' . $GLOBALS['LANG']->JScharCode($lockInfo['msg']) . '); return false;')) . '" title="' . htmlspecialchars($lockInfo['msg']) . '">' . \TYPO3\CMS\Backend\Utility\IconUtility::getSpriteIcon('status-warning-in-use') . '</a>';
                                        }
                                        $theData[$fCol] = $warning . $this->linkWrapItems($table, $row['uid'], $recTitle, $row);
-                                       // Render thumbsnails if a thumbnail column exists and there is content in it:
-                                       if ($this->thumbs && trim($row[$thumbsCol])) {
+                                       // Render thumbnails, if:
+                                       // - 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];
+                                       $visibleColumns = $GLOBALS['TCA'][$table]['types'][$type]['showitem'];
+
+                                       if ($this->thumbs &&
+                                               trim($row[$thumbsCol]) &&
+                                               preg_match('/(^|(.*(;|,)?))' . $thumbsCol . '(((;|,).*)|$)/', $visibleColumns) === 1
+                                       ) {
                                                $theData[$fCol] .= '<br />' . $this->thumbCode($row, $table, $thumbsCol);
                                        }
                                        $localizationMarkerClass = '';