From 9e01773ce29f2372f91aa26e3044156337236abd Mon Sep 17 00:00:00 2001
From: Andreas Fernandez <a.fernandez@scripting-base.de>
Date: Mon, 3 Apr 2017 19:59:04 +0200
Subject: [PATCH] [FEATURE] PageLayoutView - Allow to disable copy- /
 translate- buttons

The localization actions "Translate" and "Copy" are now toggleable by
PageTS and UserTS.

Resolves: #76910
Releases: master
Change-Id: Idee6cee57398b6ad7a24e6f84637e9ef3d33cfc5
Reviewed-on: https://review.typo3.org/52345
Tested-by: TYPO3com <no-reply@typo3.com>
Reviewed-by: Joerg Boesche <typo3@joergboesche.de>
Reviewed-by: Henrik Elsner <helsner@dfau.de>
Tested-by: Henrik Elsner <helsner@dfau.de>
Reviewed-by: Thomas Hohn <thomas@hohn.dk>
Tested-by: Mona Muzaffar <mona.muzaffar@gmx.de>
Reviewed-by: Elmar Hinz <t3elmar@gmail.com>
Reviewed-by: Jan Helke <typo3@helke.de>
Tested-by: Jan Helke <typo3@helke.de>
Reviewed-by: Christian Kuhn <lolli@schwarzbu.ch>
Tested-by: Christian Kuhn <lolli@schwarzbu.ch>
---
 .../backend/Classes/View/PageLayoutView.php   | 10 ++++++--
 ...ViewAllowToDisableCopyTranslateButtons.rst | 25 +++++++++++++++++++
 2 files changed, 33 insertions(+), 2 deletions(-)
 create mode 100644 typo3/sysext/core/Documentation/Changelog/master/Feature-76910-PageLayoutViewAllowToDisableCopyTranslateButtons.rst

diff --git a/typo3/sysext/backend/Classes/View/PageLayoutView.php b/typo3/sysext/backend/Classes/View/PageLayoutView.php
index f3b02d8b2140..57b394d38f32 100644
--- a/typo3/sysext/backend/Classes/View/PageLayoutView.php
+++ b/typo3/sysext/backend/Classes/View/PageLayoutView.php
@@ -1927,8 +1927,14 @@ class PageLayoutView extends \TYPO3\CMS\Recordlist\RecordList\AbstractDatabaseRe
         }
         $theNewButton = '';
 
-        $allowCopy = true;
-        $allowTranslate = true;
+        $localizationTsConfig = BackendUtility::getModTSconfig($this->id, 'mod.web_layout.localization');
+        $allowCopy = isset($localizationTsConfig['properties']['enableCopy'])
+            ? (int)$localizationTsConfig['properties']['enableCopy'] === 1
+            : true;
+        $allowTranslate = isset($localizationTsConfig['properties']['enableTranslate'])
+            ? (int)$localizationTsConfig['properties']['enableTranslate'] === 1
+            : true;
+
         if (!empty($this->languageHasTranslationsCache[$lP])) {
             if (isset($this->languageHasTranslationsCache[$lP]['hasStandAloneContent'])) {
                 $allowTranslate = false;
diff --git a/typo3/sysext/core/Documentation/Changelog/master/Feature-76910-PageLayoutViewAllowToDisableCopyTranslateButtons.rst b/typo3/sysext/core/Documentation/Changelog/master/Feature-76910-PageLayoutViewAllowToDisableCopyTranslateButtons.rst
new file mode 100644
index 000000000000..b575f89e1f10
--- /dev/null
+++ b/typo3/sysext/core/Documentation/Changelog/master/Feature-76910-PageLayoutViewAllowToDisableCopyTranslateButtons.rst
@@ -0,0 +1,25 @@
+.. include:: ../../Includes.txt
+
+==============================================================================
+Feature: #76910 - PageLayoutView - Allow to disable copy- / translate- buttons
+==============================================================================
+
+See :issue:`76910`
+
+Description
+===========
+
+The localization actions "Translate" and "Copy" are now toggleable by PageTS and UserTS.
+
+.. code-block:: typoscript
+
+	mod.web_layout.localization.enableCopy = 1
+	mod.web_layout.localization.enableTranslate = 1
+
+
+Impact
+======
+
+Using these options allows to disable or enable a certain action on user basis and/or page basis.
+
+.. index:: Backend, TSConfig
-- 
GitLab