Feature #76910

PageLayoutView - Allow to disable copy- / translate- buttons

Added by Philipp Schlosser over 2 years ago. Updated 4 days ago.

Status:
Resolved
Priority:
Should have
Assignee:
-
Category:
Backend User Interface
Target version:
-
Start date:
2016-07-01
Due date:
% Done:

100%

PHP Version:
Tags:
Complexity:
Sprint Focus:

Description

Could there be an option to configure visibility of the "translate" and "copy" buttons (see Screenshot - I use TYPO3 7.6.9).

In \TYPO3\CMS\Backend\View\PageLayoutView following data-attributes were set to the button .t3js-localize in Line 1828 and 1829 :
' data-allow-copy="' . (int)$allowCopy . '"'
' data-allow-translate="' . (int)$allowTranslate . '"'

if you set $allowCopy or $allowTranslate manually to 0 the button for copying or translating your content will disappear, but you have no opportunity to do this by a configuration or by a hook.

translate-copy-button.png View (48.2 KB) Philipp Schlosser, 2016-07-01 15:26

Associated revisions

Revision 9e01773c (diff)
Added by Andreas Fernandez over 1 year ago

[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 <>
Reviewed-by: Joerg Boesche <>
Reviewed-by: Henrik Elsner <>
Tested-by: Henrik Elsner <>
Reviewed-by: Thomas Hohn <>
Tested-by: Mona Muzaffar <>
Reviewed-by: Elmar Hinz <>
Reviewed-by: Jan Helke <>
Tested-by: Jan Helke <>
Reviewed-by: Christian Kuhn <>
Tested-by: Christian Kuhn <>

Revision 2c653922 (diff)
Added by André Schließer 4 days ago

[BUGFIX] PageLayoutView - Keep copy settings if disabled

Disable copy option if setting mod.web_layout.localization.enableCopy = 0
in all cases.

As a newly translated page has no copies or translations this variable
will be false and this results in $allowCopy = true.
To disable the copy mode the initial setting $allowCopy
is taken into account.

Resolves: #76910
Releases: master
Change-Id: I38f16a11038885c1ba0d455d7913d729e9669817
Reviewed-on: https://review.typo3.org/59016
Reviewed-by: Mona Muzaffar <>
Tested-by: Mona Muzaffar <>
Tested-by: TYPO3com <>
Reviewed-by: Markus Klein <>
Tested-by: Markus Klein <>

History

#1 Updated by Peter Rauber over 2 years ago

Hi Philipp

I know a way how to hide this via css in the backend:

Here is my scss-file, that will complie into an css-file:

// hide copy in page-module localization wizard (only translation allowed)
.t3-modal {
    &.localization-wizard {
        #localization-carousel {
            .item {
                .row {
                    .t3js-helptext {
                        display: none;
                    }

                    &:last-child {
                        display: none;
                    }

                    &:first-child {
                        display: block;
                    }
                }

                .t3js-summary {
                    .row {
                        &:last-child {
                            display: block;
                        }
                    }
                }
            }
        }
    }
}

To load the css in the backend, put this in your ext_tables.php (of an extension):

// add own backend stylesheet
if (TYPO3_MODE === 'BE') {
    // Register as a skin
    $GLOBALS['TBE_STYLES']['skins']['yourextensionname'] = array(
        'name' => 'yourextensionname',
        'stylesheetDirectories' => array(
            'css' => 'EXT:yourextensionname/Resources/Public/Css/'
        )
    );
}

Hope this helps.

#2 Updated by Riccardo De Contardi over 2 years ago

  • Category set to Backend User Interface

#3 Updated by Sven Liebendahl over 1 year ago

Hi Phillip,

me and my colleagues stumbled across the same issue: We simply wanted to disable the strict translation-mode button in the localization wizard.
I asked for help in the slack channel #cig-localization and a suggested solution by Andreas Fernandez was to use XCLASSing – which worked for me. I know it is not the best way possible, but it is a working solution:

XCLASSing TYPO3\CMS\Backend\View\PageLayoutView and overriding the method newLanguageButton should be sufficient. Hint: either data-allow-copy or data-allow-translate must be 0 respectively false then.

It would be handy if you could configure that with typoscript so that you easily can choose the available modes (buttons) of translation.

#4 Updated by Gerrit Code Review over 1 year ago

  • Status changed from New to Under Review

Patch set 1 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/52345

#5 Updated by Andreas Fernandez over 1 year ago

  • Status changed from Under Review to Resolved
  • % Done changed from 0 to 100

#6 Updated by Benni Mack 2 months ago

  • Status changed from Resolved to Closed

#7 Updated by André Schließer 14 days ago

  • Status changed from Closed to New

The PageTS Setting

mod.web_layout.localization.enableCopy = 0
does not remove the copy button in the translation modal.

The other option

mod.web_layout.localization.enableTranslate = 0
works as expected.

Tested with TYPO3 9.5.1 in custom installation and a installation with the introduction package.

#8 Updated by André Schließer 11 days ago

After a bit of debugging I found out that the setting is overwritten on line 2435 in typo3/sysext/backend/Classes/View/PageLayoutView.php if there are no translations for the selected language.

If there is nothing on the translated page the variable $this->languageHasTranslationsCache[$lP]['hasTranslations']… will be @false. The inverted value is then set for $allowCopy. This behavior was implemented to fix an other Bug #62550

#9 Updated by Gerrit Code Review 8 days ago

  • Status changed from New to Under Review

Patch set 1 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/59016

#10 Updated by Gerrit Code Review 8 days ago

Patch set 2 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/59016

#11 Updated by Gerrit Code Review 8 days ago

Patch set 3 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/59016

#12 Updated by Gerrit Code Review 4 days ago

Patch set 4 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/59016

#13 Updated by Gerrit Code Review 4 days ago

Patch set 5 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/59016

#14 Updated by Gerrit Code Review 4 days ago

Patch set 6 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/59016

#15 Updated by Anonymous 4 days ago

  • Status changed from Under Review to Resolved

Also available in: Atom PDF