[TASK] Improve RST and condition for filelist translations 52/62952/3
authorDaniel Goerz <daniel.goerz@posteo.de>
Thu, 16 Jan 2020 15:33:29 +0000 (16:33 +0100)
committerBenni Mack <benni@typo3.org>
Sat, 18 Jan 2020 15:41:27 +0000 (16:41 +0100)
Resolves: #90137
Relates: #90114
Releases: master
Change-Id: I09404a3553632298174f13bc758883bdd8f03e0d
Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/62952
Tested-by: TYPO3com <noreply@typo3.com>
Tested-by: Benni Mack <benni@typo3.org>
Reviewed-by: Benni Mack <benni@typo3.org>
typo3/sysext/core/Documentation/Changelog/master/Feature-90114-DisableTranslationOfFilelist.rst [deleted file]
typo3/sysext/core/Documentation/Changelog/master/Feature-90114-MakeTranslationOfFilelistOptional.rst [new file with mode: 0644]
typo3/sysext/filelist/Classes/FileList.php

diff --git a/typo3/sysext/core/Documentation/Changelog/master/Feature-90114-DisableTranslationOfFilelist.rst b/typo3/sysext/core/Documentation/Changelog/master/Feature-90114-DisableTranslationOfFilelist.rst
deleted file mode 100644 (file)
index b1e66c0..0000000
+++ /dev/null
@@ -1,26 +0,0 @@
-.. include:: ../../Includes.txt
-
-=================================================
-Feature: #90114 - Disable translation of filelist
-=================================================
-
-See :issue:`90114`
-
-Description
-===========
-
-Currently there is no simple solution to disable/enable the translation of the files in the (BE menu) filelist.
-
-But this could be done programmatically by unsetting languageField in the sys_file_metadata.php like
-
-`unset($GLOBALS['TCA']['sys_file_metadata']['ctrl']['languageField']);`
-
-
-Impact
-======
-
-If unsetting
-`$GLOBALS['TCA']['sys_file_metadata']['ctrl']['languageField']`
-then the world toggle button in the (BE) Filelist would disappear which means that translating the metadata the file metadata are not possible anymore. Be aware that existing translations may also become unaccessible, at least via BE.
-
-.. index:: Backend, FAL, TCA, ext:filelist
diff --git a/typo3/sysext/core/Documentation/Changelog/master/Feature-90114-MakeTranslationOfFilelistOptional.rst b/typo3/sysext/core/Documentation/Changelog/master/Feature-90114-MakeTranslationOfFilelistOptional.rst
new file mode 100644 (file)
index 0000000..a4c1ec0
--- /dev/null
@@ -0,0 +1,22 @@
+.. include:: ../../Includes.txt
+
+=======================================================
+Feature: #90114 - Make translation of filelist optional
+=======================================================
+
+See :issue:`90114`
+
+Description
+===========
+
+The filelist module now takes :php:`$GLOBALS['TCA']['sys_file_metadata']['ctrl']['languageField']`
+into account. By unsetting the field, translations in the filelist module are no longer possible.
+
+
+Impact
+======
+
+If :php:`$GLOBALS['TCA']['sys_file_metadata']['ctrl']['languageField']` is set to an empty value,
+translations are disabled for the filelist module.
+
+.. index:: Backend, FAL, TCA, ext:filelist
index fcb49d5..3814f20 100644 (file)
@@ -1015,7 +1015,7 @@ class FileList
                         $theData[$field] = $this->makeClip($fileObject);
                         break;
                     case '_LOCALIZATION_':
-                        if (!empty($systemLanguages) && $fileObject->isIndexed() && $fileObject->checkActionPermission('editMeta') && $this->getBackendUser()->check('tables_modify', 'sys_file_metadata') && !is_null($GLOBALS['TCA']['sys_file_metadata']['ctrl']['languageField'])) {
+                        if (!empty($systemLanguages) && $fileObject->isIndexed() && $fileObject->checkActionPermission('editMeta') && $this->getBackendUser()->check('tables_modify', 'sys_file_metadata') && !empty($GLOBALS['TCA']['sys_file_metadata']['ctrl']['languageField'] ?? null)) {
                             $metaDataRecord = $fileObject->getMetaData()->get();
                             $translations = $this->getTranslationsForMetaData($metaDataRecord);
                             $languageCode = '';