[BUGFIX] Don't show new button when adding a new record 06/60506/2
authorBenni Mack <benni@typo3.org>
Wed, 17 Apr 2019 21:49:02 +0000 (23:49 +0200)
committerSusanne Moog <look@susi.dev>
Thu, 18 Apr 2019 14:33:22 +0000 (16:33 +0200)
As there is no "pid" available, the new button on new
records should not be shown.

Resolves: #87721
Releases: master, 9.5
Change-Id: Ie3521882e38f031d3362de841351b058faed9521
Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/60506
Tested-by: TYPO3com <noreply@typo3.com>
Tested-by: Josef Glatz <josefglatz@gmail.com>
Tested-by: Susanne Moog <look@susi.dev>
Reviewed-by: Josef Glatz <josefglatz@gmail.com>
Reviewed-by: Susanne Moog <look@susi.dev>
typo3/sysext/backend/Classes/Controller/EditDocumentController.php

index d4cecdf..1ebb040 100644 (file)
@@ -1227,20 +1227,22 @@ class EditDocumentController
         ) {
             $this->registerSaveButtonToButtonBar($buttonBar, ButtonBar::BUTTON_POSITION_LEFT, 2);
             $this->registerViewButtonToButtonBar($buttonBar, ButtonBar::BUTTON_POSITION_LEFT, 3);
-            $this->registerNewButtonToButtonBar(
-                $buttonBar,
-                ButtonBar::BUTTON_POSITION_LEFT,
-                4,
-                $sysLanguageUid,
-                $l18nParent
-            );
-            $this->registerDuplicationButtonToButtonBar(
-                $buttonBar,
-                ButtonBar::BUTTON_POSITION_LEFT,
-                5,
-                $sysLanguageUid,
-                $l18nParent
-            );
+            if ($this->firstEl['cmd'] !== 'new') {
+                $this->registerNewButtonToButtonBar(
+                    $buttonBar,
+                    ButtonBar::BUTTON_POSITION_LEFT,
+                    4,
+                    $sysLanguageUid,
+                    $l18nParent
+                );
+                $this->registerDuplicationButtonToButtonBar(
+                    $buttonBar,
+                    ButtonBar::BUTTON_POSITION_LEFT,
+                    5,
+                    $sysLanguageUid,
+                    $l18nParent
+                );
+            }
             $this->registerDeleteButtonToButtonBar($buttonBar, ButtonBar::BUTTON_POSITION_LEFT, 6);
             $this->registerColumnsOnlyButtonToButtonBar($buttonBar, ButtonBar::BUTTON_POSITION_LEFT, 7);
             $this->registerHistoryButtonToButtonBar($buttonBar, ButtonBar::BUTTON_POSITION_RIGHT, 1);