[BUGFIX] TCAtree must use BackendUtility::getRecordTitle() 01/38101/5
authorGeorg Ringer <georg.ringer@gmail.com>
Tue, 24 Mar 2015 12:49:09 +0000 (13:49 +0100)
committerMarkus Klein <klein.t3@reelworx.at>
Tue, 24 Mar 2015 13:34:14 +0000 (14:34 +0100)
If building a tree from records the label of an item must be
generated by using BackendUtility::getRecordTitle to be consistent
with the rest of the backend (e.g. the list module).

Change-Id: I3e362be17dc4ef6ea27958b6e440b9f69ddbad0d
Resolves: #65974
Releases: master, 6.2
Reviewed-on: http://review.typo3.org/38101
Reviewed-by: Tymoteusz Motylewski <t.motylewski@gmail.com>
Tested-by: Tymoteusz Motylewski <t.motylewski@gmail.com>
Reviewed-by: Markus Klein <klein.t3@reelworx.at>
Tested-by: Markus Klein <klein.t3@reelworx.at>
typo3/sysext/core/Classes/Tree/TableConfiguration/DatabaseTreeDataProvider.php

index 90c60ad..7a8ee9b 100644 (file)
@@ -14,6 +14,7 @@ namespace TYPO3\CMS\Core\Tree\TableConfiguration;
  * The TYPO3 project - inspiring people to share!
  */
 
+use TYPO3\CMS\Backend\Utility\BackendUtility;
 use TYPO3\CMS\Core\Utility\GeneralUtility;
 
 /**
@@ -241,12 +242,8 @@ class DatabaseTreeDataProvider extends AbstractTableConfigurationTreeDataProvide
                        $node->setExpanded(TRUE);
                        $node->setLabel($GLOBALS['LANG']->sL($GLOBALS['TCA'][$this->tableName]['ctrl']['title']));
                } else {
-                       $row = \TYPO3\CMS\Backend\Utility\BackendUtility::getRecordWSOL($this->tableName, $basicNode->getId(), '*', '', FALSE);
-                       if ($this->getLabelField() !== '') {
-                               $node->setLabel($row[$this->getLabelField()]);
-                       } else {
-                               $node->setLabel($basicNode->getId());
-                       }
+                       $row = BackendUtility::getRecordWSOL($this->tableName, $basicNode->getId(), '*', '', FALSE);
+                       $node->setLabel(BackendUtility::getRecordTitle($this->tableName, $row) ?: $basicNode->getId());
                        $node->setSelected(GeneralUtility::inList($this->getSelectedList(), $basicNode->getId()));
                        $node->setExpanded($this->isExpanded($basicNode));
                }