[BUGFIX] Handle new record correctly in selectTree form element 77/49577/2
authorTymoteusz Motylewski <t.motylewski@gmail.com>
Wed, 24 Aug 2016 15:41:01 +0000 (17:41 +0200)
committerGeorg Ringer <georg.ringer@gmail.com>
Thu, 25 Aug 2016 05:14:07 +0000 (07:14 +0200)
Pass command (edit/new) from input data attribute
to SelectTreeController.

Resolves: #77621
Releases: master
Change-Id: I58b5099402cbce3f50a2681eefa6ab4bba263a56
Reviewed-on: https://review.typo3.org/49577
Tested-by: Bamboo TYPO3com <info@typo3.com>
Reviewed-by: Benni Mack <benni@typo3.org>
Reviewed-by: Wouter Wolters <typo3@wouterwolters.nl>
Tested-by: Benni Mack <benni@typo3.org>
Reviewed-by: Georg Ringer <georg.ringer@gmail.com>
Tested-by: Georg Ringer <georg.ringer@gmail.com>
typo3/sysext/backend/Classes/Controller/SelectTreeController.php
typo3/sysext/backend/Classes/Form/Element/SelectTreeElement.php
typo3/sysext/backend/Resources/Public/JavaScript/FormEngine/Element/SelectTreeElement.js

index f9adac9..4dac075 100644 (file)
@@ -44,7 +44,7 @@ class SelectTreeController
         $formDataCompilerInput = [
             'tableName' => $request->getQueryParams()['table'],
             'vanillaUid' => (int)$request->getQueryParams()['uid'],
-            'command' => 'edit',
+            'command' => $request->getQueryParams()['command'],
         ];
         $fieldName = $request->getQueryParams()['field'];
         $formData = $formDataCompiler->compile($formDataCompilerInput);
index 9b2b01a..71d7176 100644 (file)
@@ -69,6 +69,7 @@ class SelectTreeElement extends AbstractFormElement
         $html[] = '           data-table="' . htmlspecialchars($this->data['tableName']) . '"';
         $html[] = '           data-field="' . htmlspecialchars($this->data['fieldName']) . '"';
         $html[] = '           data-uid="' . (int)$this->data['vanillaUid'] . '"';
+        $html[] = '           data-command="' . htmlspecialchars($this->data['command']) . '"';
         $html[] = '           data-read-only="' . $readOnly . '"';
         $html[] = '           data-tree-exclusive-keys="' . htmlspecialchars($exclusiveKeys) . '"';
         $html[] = '           data-tree-expand-up-to-level="' . ($expanded ? '999' : '1') . '"';
index 4a1fff1..d590b5e 100644 (file)
@@ -29,7 +29,8 @@ define(['jquery', 'TYPO3/CMS/Backend/FormEngine/Element/SelectTree'], function (
             var dataParams = {
                 table: treeInput.data('table'),
                 field: treeInput.data('field'),
-                uid: treeInput.data('uid')
+                uid: treeInput.data('uid'),
+                command: treeInput.data('command')
             };
             var $wrapper = treeInput.parent().siblings('.svg-tree-wrapper');
             var dataUrl = TYPO3.settings.ajaxUrls['record_tree_data'] + '&' + TYPO3.jQuery.param(dataParams);