[BUGFIX] Fix wrong column title in web>list for field colpos
authorMartin Kästner <mkaestner@gmx.de>
Wed, 28 Nov 2012 14:14:26 +0000 (15:14 +0100)
committerChristian Kuhn <lolli@schwarzbu.ch>
Sat, 1 Dec 2012 14:45:27 +0000 (15:45 +0100)
When activating the field colPos for tt_content elements and using
a backend_layout the wrong column titles are shown, without respect
to a backend_layout set.

Resolves: #25113
Releases: 6.1, 6.0, 4.7, 4.6, 4.5

Change-Id: Ie85bf8ba195343faa2c846aa6eb847646510a13e
Reviewed-on: http://review.typo3.org/16917
Reviewed-by: Christian Kuhn
Tested-by: Christian Kuhn
typo3/sysext/recordlist/Classes/RecordList/DatabaseRecordList.php

index f00911f..4e67339 100644 (file)
@@ -619,6 +619,25 @@ class DatabaseRecordList extends \TYPO3\CMS\Recordlist\RecordList\AbstractDataba
                        $alttext = \TYPO3\CMS\Backend\Utility\BackendUtility::getRecordIconAltText($row, $table);
                        $iconImg = \TYPO3\CMS\Backend\Utility\IconUtility::getSpriteIconForRecord($table, $row, array('title' => htmlspecialchars($alttext), 'style' => $indent ? ' margin-left: ' . $indent . 'px;' : ''));
                        $theIcon = $this->clickMenuEnabled ? $GLOBALS['SOBE']->doc->wrapClickMenuOnIcon($iconImg, $table, $row['uid']) : $iconImg;
                        $alttext = \TYPO3\CMS\Backend\Utility\BackendUtility::getRecordIconAltText($row, $table);
                        $iconImg = \TYPO3\CMS\Backend\Utility\IconUtility::getSpriteIconForRecord($table, $row, array('title' => htmlspecialchars($alttext), 'style' => $indent ? ' margin-left: ' . $indent . 'px;' : ''));
                        $theIcon = $this->clickMenuEnabled ? $GLOBALS['SOBE']->doc->wrapClickMenuOnIcon($iconImg, $table, $row['uid']) : $iconImg;
+
+                       // Have labels respect possible itemsProcFunc results
+                       /** @var $formEngine \TYPO3\CMS\Backend\Form\FormEngine */
+                       $formEngine = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Backend\\Form\\FormEngine');
+                       if (isset($GLOBALS['TCA'][$table]['columns'])) {
+                               foreach ($GLOBALS['TCA'][$table]['columns'] as $field => $fieldSetup) {
+                                       if (isset($fieldSetup['config']['itemsProcFunc']) && $fieldSetup['config']['itemsProcFunc']) {
+                                               $GLOBALS['TCA'][$table]['columns'][$field]['config']['items'] = $formEngine->procItems(
+                                                       $fieldSetup['config']['items'],
+                                                       $fieldSetup['config']['itemsProcFunc'],
+                                                       $fieldSetup['config'],
+                                                       $table,
+                                                       $row,
+                                                       $field
+                                               );
+                                       }
+                               }
+                       }
+
                        // Preparing and getting the data-array
                        $theData = array();
                        foreach ($this->fieldArray as $fCol) {
                        // Preparing and getting the data-array
                        $theData = array();
                        foreach ($this->fieldArray as $fCol) {