[BUGFIX] Starttime and endtime no longer accessible in content edit form 02/43302/2
authorLoek Hilgersom <loek@netcoop.nl>
Mon, 14 Sep 2015 14:33:18 +0000 (16:33 +0200)
committerSusanne Moog <typo3@susannemoog.de>
Mon, 14 Sep 2015 16:05:23 +0000 (18:05 +0200)
This fixes that l10n_display also affects the original not-translated
record. Problem was caused by the type-change of $row[$languageField]
from int to array.
Added a few comments for making the code more understandable.

Resolves: #69779
Releases: master
Change-Id: I29b0ad47332f34a292624fad3938554fb1e55353
Reviewed-on: http://review.typo3.org/43302
Reviewed-by: Christian Kuhn <lolli@schwarzbu.ch>
Tested-by: Christian Kuhn <lolli@schwarzbu.ch>
Reviewed-by: Michael Oehlhof <typo3@oehlhof.de>
Tested-by: Michael Oehlhof <typo3@oehlhof.de>
Reviewed-by: Susanne Moog <typo3@susannemoog.de>
Tested-by: Susanne Moog <typo3@susannemoog.de>
typo3/sysext/backend/Classes/Form/Container/SingleFieldContainer.php

index f2c0a9e..88bbb10 100644 (file)
@@ -59,17 +59,20 @@ class SingleFieldContainer extends AbstractContainer {
                $parameterArray = array();
                $parameterArray['fieldConf'] = $this->data['processedTca']['columns'][$fieldName];
 
+               $languageField = $this->data['processedTca']['ctrl']['languageField'];
+
                // A couple of early returns in case the field should not be rendered
                // Check if this field is configured and editable according to exclude fields and other configuration
                if (
-                       // @todo: another user access rights check!
+                       // Return if BE-user has no access rights to this field, @todo: another user access rights check!
                        $parameterArray['fieldConf']['exclude'] && !$backendUser->check('non_exclude_fields', $table . ':' . $fieldName)
                        || $parameterArray['fieldConf']['config']['type'] === 'passthrough'
                        // @todo: Drop option "showIfRTE" ?
                        || !$backendUser->isRTE() && $parameterArray['fieldConf']['config']['showIfRTE']
-                       || $this->data['processedTca']['ctrl']['languageField'] && !$parameterArray['fieldConf']['l10n_display'] && $parameterArray['fieldConf']['l10n_mode'] === 'exclude' && ($row[$GLOBALS['TCA'][$table]['ctrl']['languageField']] > 0)
+                       // Return if field should not be rendered in translated records
+                       || $languageField && !$parameterArray['fieldConf']['l10n_display'] && $parameterArray['fieldConf']['l10n_mode'] === 'exclude' && is_array($row[$languageField]) && $row[$languageField][0] > 0
                        // @todo: localizationMode still needs handling!
-                       || $this->data['processedTca']['ctrl']['languageField'] && $this->data['localizationMode'] && $this->data['localizationMode'] !== $parameterArray['fieldConf']['l10n_cat']
+                       || $languageField && $this->data['localizationMode'] && $this->data['localizationMode'] !== $parameterArray['fieldConf']['l10n_cat']
                        || $this->inlineFieldShouldBeSkipped()
                ) {
                        return $resultArray;
@@ -105,7 +108,7 @@ class SingleFieldContainer extends AbstractContainer {
                // Set field to read-only if configured for translated records to show default language content as readonly
                if ($parameterArray['fieldConf']['l10n_display']
                        && GeneralUtility::inList($parameterArray['fieldConf']['l10n_display'], 'defaultAsReadonly')
-                       && $row[$this->data['processedTca']['ctrl']['languageField']] > 0
+                       && is_array($row[$languageField]) && $row[$languageField][0] > 0
                ) {
                        $parameterArray['fieldConf']['config']['readOnly'] = TRUE;
                        $parameterArray['itemFormElValue'] = $this->data['defaultLanguageData'][$table . ':' . $row['uid']][$fieldName];