[BUGFIX] Creating new pages via drag'n'drop respects page TS
[Packages/TYPO3.CMS.git] / t3lib / tree / pagetree / class.t3lib_tree_pagetree_commands.php
index 532761e..69c3923 100644 (file)
@@ -134,11 +134,20 @@ final class t3lib_tree_pagetree_Commands {
         */
        public static function createNode(t3lib_tree_pagetree_Node $parentNode, $targetId, $pageType) {
                $placeholder = 'NEW12345';
-               $data['pages'][$placeholder] = array(
-                       'pid' => $parentNode->getWorkspaceId(),
-                       'doktype' => $pageType,
-                       'title' => $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xml:tree.defaultPageTitle', TRUE),
-               );
+               $pid = $parentNode->getWorkspaceId();
+
+                       // Use page TsConfig as default page initialization
+               $pageTs = t3lib_BEfunc::getPagesTSconfig($pid);
+               if (array_key_exists('TCAdefaults.', $pageTs) && array_key_exists('pages.', $pageTs['TCAdefaults.'])) {
+                       $data['pages'][$placeholder] = $pageTs['TCAdefaults.']['pages.'];
+               } else {
+                       $data['pages'][$placeholder] = array();
+               }
+
+               $data['pages'][$placeholder]['pid'] = $pid;
+               $data['pages'][$placeholder]['doktype'] = $pageType;
+               $data['pages'][$placeholder]['title'] = $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xml:tree.defaultPageTitle', TRUE);
+
                $newPageId = self::processTceCmdAndDataMap(array(), $data);
                $node = self::getNode($newPageId[$placeholder]);