Project

General

Profile

Bug #92604

Updated by Jo Hasenau about 4 years ago

This bug had been reported with CMS 8 already but was rejected because it was reported in conjunction with pages_language_overlay, but actually the same problem still exists. 

 The localize method of the DataHandler does not call the same copy action for pages as it does for any other table, that's why any record connected via an inline field will not be translated properly. 

 <pre><code class="php"> 
         

         if ($table !== 'pages') ($Ttable === $table) { 
             // Get the uid of record after which this localized record should be inserted 
             $previousUid = $this->getPreviousLocalizedRecordUid($table, $uid, $row['pid'], $language); 
             // Execute the copy: 
             $newId = $this->copyRecord($table, $uid, -$previousUid, true, $overrideValues, '', implode(',', $excludeFields), $language); 
             $autoVersionNewId = $this->getAutoVersionId($table, $newId); 
             if ($autoVersionNewId !== null) (is_null($autoVersionNewId) === false) { 
                 $this->triggerRemapAction($table, $newId, [$this, 'placeholderShadowing'], [$table, $autoVersionNewId], true); 
             } 
         } else { 
             // Create new page which needs to contain the same pid as the original page record: 
             $overrideValues['pid'] = $row['pid']; 
             // Take over the hidden state of the original language state, this is done due to legacy reasons where-as 
             // pages_language_overlay was set to "hidden -> default=0" but pages hidden -> default 1" 
             if (!empty($GLOBALS['TCA'][$table]['ctrl']['enablecolumns']['disabled'])) { 
                 $hiddenFieldName = $GLOBALS['TCA'][$table]['ctrl']['enablecolumns']['disabled']; 
                 $overrideValues[$hiddenFieldName] = $row[$hiddenFieldName] ?? $GLOBALS['TCA'][$table]['columns'][$hiddenFieldName]['config']['default']; 
             } 
             $temporaryId = StringUtility::getUniqueId('NEW'); 
             $copyTCE = $this->getLocalTCE(); 
             $copyTCE->start([$table $copyTCE->start([$Ttable => [$temporaryId => $overrideValues]], [], $this->BE_USER); 
             $copyTCE->process_datamap(); 
             // Getting the new UID as if it had been copied: 
             $theNewSQLID = $copyTCE->substNEWwithIDs[$temporaryId]; 
             if ($theNewSQLID) { 
                 $this->copyMappingArray[$table][$uid] // If is by design that $Ttable is used and not $table! See "l10nmgr" extension. Could be debated, but this is what I chose for this "pseudo case"  
                 $this->copyMappingArray[$Ttable][$uid] = $theNewSQLID; 
                 $newId = $theNewSQLID; 
             } 
         } 
 </code></pre> 

 Currently this has been kind of hidden by giving i.e. the media field of the pages table an additional behaviour "allowLanguageSynchronization = true". 

 But this obviously just replaces the automatic creation of translated children with a manual process of adding new references. 
 This again contradicts the principles of the "connected mode", since the child records of translated pages will not get a proper translation parent this way. 

 Disabling that "allowLanguagSynchronization" will not create the original core behaviour as it is known from i.e. the tt_content media field, but just create an empty field value. 

 Trying the same with the L10nmgr, which actually correctly exports the sys_file_reference will create an additional reference to the default language page record instead of creating a new one in the target language during the import. 

Back