[FEATURE] Hide "duplicate" button by default 86/56686/3
authorRens Admiraal <rens@simplyadmire.com>
Mon, 16 Apr 2018 14:13:05 +0000 (16:13 +0200)
committerFrank Naegler <frank.naegler@typo3.org>
Tue, 17 Apr 2018 11:35:42 +0000 (13:35 +0200)
Hides the "duplicate" button in TCEFORMs by default as it serves
a very specific usecase best enabled on a table basis.

Example snippet:
```
options.showDuplicate = 1
options.showDuplicate.[table] = 1
```

Resolves: #84749
Releases: master
Change-Id: Ia15202e197b81ff4d97f6e71b673910ec7cded93
Reviewed-on: https://review.typo3.org/56686
Tested-by: TYPO3com <no-reply@typo3.com>
Reviewed-by: Mathias Schreiber <mathias.schreiber@typo3.com>
Tested-by: Mathias Schreiber <mathias.schreiber@typo3.com>
Reviewed-by: Wouter Wolters <typo3@wouterwolters.nl>
Reviewed-by: Frans Saris <franssaris@gmail.com>
Reviewed-by: Richard Haeser <richard@maxserv.com>
Tested-by: Richard Haeser <richard@maxserv.com>
Reviewed-by: Frank Naegler <frank.naegler@typo3.org>
Tested-by: Frank Naegler <frank.naegler@typo3.org>
typo3/sysext/backend/Classes/Controller/EditDocumentController.php
typo3/sysext/core/Documentation/Changelog/master/Feature-84749-HideDuplicateButtonByDefault.rst [new file with mode: 0644]

index 923c5ce..099237b 100644 (file)
@@ -1479,7 +1479,13 @@ class EditDocumentController
             ? (int)$record[$TCActrl['languageField']]
             : 0;
         $showDuplicateButton = false;
-        if ($this->firstEl['cmd'] !== 'new' && $this->firstEl['table'] !== 'sys_file_metadata' && MathUtility::canBeInterpretedAsInteger($this->firstEl['uid'])) {
+        if (
+            $this->firstEl['cmd'] !== 'new'
+            && $this->firstEl['table'] !== 'sys_file_metadata'
+            && MathUtility::canBeInterpretedAsInteger($this->firstEl['uid'])
+            && !empty($this->firstEl['table'])
+            && $this->getTsConfigOption($this->firstEl['table'], 'showDuplicate')
+        ) {
             if ($sysLanguageUid === 0) {
                 // show button, if record is in default language
                 $showDuplicateButton = true;
diff --git a/typo3/sysext/core/Documentation/Changelog/master/Feature-84749-HideDuplicateButtonByDefault.rst b/typo3/sysext/core/Documentation/Changelog/master/Feature-84749-HideDuplicateButtonByDefault.rst
new file mode 100644 (file)
index 0000000..9afefb2
--- /dev/null
@@ -0,0 +1,23 @@
+.. include:: ../../Includes.txt
+
+====================================================
+Feature: #84749 - Hide "duplicate" button by default
+====================================================
+
+See :issue:`84749`
+
+Description
+===========
+
+The "duplicate" button visibility can now be managed with userTsConfig using:
+
+options.showDuplicate = 1
+options.showDuplicate.[table] = 1
+
+
+Impact
+======
+
+The button was only introduced in 9.0, but would with this change be hidden again.
+
+.. index:: Backend, TSConfig, ext:backend
\ No newline at end of file