[BUGFIX] Show labels of additional doktypes in new page drag area 34/24934/3
authorCaspar Stuebs <caspar@gosign.de>
Mon, 21 Oct 2013 14:46:35 +0000 (16:46 +0200)
committerWouter Wolters <typo3@wouterwolters.nl>
Tue, 18 Feb 2014 22:47:37 +0000 (23:47 +0100)
Get the labels for the doktypes from TCA

Resolves: #52955
Releases: 6.2, 6.1
Change-Id: I6d70c11f1711bf191a4ce14a91796819224649da
Reviewed-on: https://review.typo3.org/24934
Reviewed-by: Wouter Wolters
Tested-by: Wouter Wolters
typo3/sysext/backend/Classes/Tree/Pagetree/ExtdirectTreeDataProvider.php

index ab8c836..7cf1797 100644 (file)
@@ -118,16 +118,13 @@ class ExtdirectTreeDataProvider extends \TYPO3\CMS\Backend\Tree\AbstractExtJsTre
         * @return array
         */
        public function getNodeTypes() {
         * @return array
         */
        public function getNodeTypes() {
-               $map = array(
-                       1 => 'LLL:EXT:lang/locallang_tca.xlf:doktype.I.0',
-                       3 => 'LLL:EXT:cms/locallang_tca.xlf:pages.doktype.I.8',
-                       4 => 'LLL:EXT:cms/locallang_tca.xlf:pages.doktype.I.2',
-                       6 => 'LLL:EXT:cms/locallang_tca.xlf:pages.doktype.I.4',
-                       7 => 'LLL:EXT:cms/locallang_tca.xlf:pages.doktype.I.5',
-                       199 => 'LLL:EXT:cms/locallang_tca.xlf:pages.doktype.I.7',
-                       254 => 'LLL:EXT:lang/locallang_tca.xlf:doktype.I.folder',
-                       255 => 'LLL:EXT:lang/locallang_tca.xlf:doktype.I.2'
-               );
+               $doktypeLabelMap = array();
+               foreach ($GLOBALS['TCA']['pages']['columns']['doktype']['config']['items'] as $doktypeItemConfig) {
+                       if ($doktypeItemConfig[1] === '--div--') {
+                               continue;
+                       }
+                       $doktypeLabelMap[$doktypeItemConfig[1]] = $doktypeItemConfig[0];
+               }
                $doktypes = GeneralUtility::trimExplode(',', $GLOBALS['BE_USER']->getTSConfigVal('options.pageTree.doktypesToShowInNewPageDragArea'));
                $output = array();
                $allowedDoktypes = GeneralUtility::trimExplode(',', $GLOBALS['BE_USER']->groupData['pagetypes_select']);
                $doktypes = GeneralUtility::trimExplode(',', $GLOBALS['BE_USER']->getTSConfigVal('options.pageTree.doktypesToShowInNewPageDragArea'));
                $output = array();
                $allowedDoktypes = GeneralUtility::trimExplode(',', $GLOBALS['BE_USER']->groupData['pagetypes_select']);
@@ -136,7 +133,7 @@ class ExtdirectTreeDataProvider extends \TYPO3\CMS\Backend\Tree\AbstractExtJsTre
                        if (!$isAdmin && !in_array($doktype, $allowedDoktypes)) {
                                continue;
                        }
                        if (!$isAdmin && !in_array($doktype, $allowedDoktypes)) {
                                continue;
                        }
-                       $label = $GLOBALS['LANG']->sL($map[$doktype], TRUE);
+                       $label = $GLOBALS['LANG']->sL($doktypeLabelMap[$doktype], TRUE);
                        $spriteIcon = IconUtility::getSpriteIconClasses($GLOBALS['TCA']['pages']['ctrl']['typeicon_classes'][$doktype]);
                        $output[] = array(
                                'nodeType' => $doktype,
                        $spriteIcon = IconUtility::getSpriteIconClasses($GLOBALS['TCA']['pages']['ctrl']['typeicon_classes'][$doktype]);
                        $output[] = array(
                                'nodeType' => $doktype,