Bug #81315
closedTranslation of inline elements fails, when only one item is to be translated
0%
Description
When i try to translate a page with an inline field with only 1 entry, the translation doesn't generate the translated entry.
It is okay for more than 1 entry.
The error resides in the DataMapProcessor::synchronizeInlineRelations function on row 581.
$sanitizedValue = $this->sanitizationMap[$item->getTableName()][$item->getId()][$fieldName] ?? null; if ( !empty($missingAncestorIds) && $item->isNew() && $sanitizedValue !== null && count(GeneralUtility::trimExplode(',', $sanitizedValue)) === count($missingAncestorIds) ) { $this->modifyDataMap( $item->getTableName(), $item->getId(), [$fieldName => $sanitizedValue] ); return; }
If $sanitizedValue is an empty string, "GeneralUtility::trimExplode(',', $sanitizedValue)" WILL return an array with one empty string as a value, therefore the count is 1 which is wrong on inline elements with 1 entry.
The check "$sanitizedValue !== null" is therefore no adequate check for this string (and in general for strings, too :p) and should be "!empty($sanitizedValue)".
I attached a patchfile (generated on TYPO3 v8.7.1) which will do exactly that.
If you want to reproduce this error, here my TCA-Column (defined in "pages" & "pages_language_overlay", 1:N, table "tx_pbsite_domain_model_slideritem" is fully translatable):
'slider' => [ 'exclude' => 1, 'label' => 'LLL:EXT:pb_site/Resources/Private/Language/locallang.xlf:pages.fields.slider', 'config' => [ 'type' => 'inline', 'foreign_table' => 'tx_pbsite_domain_model_slideritem', 'foreign_match_fields' => [ 'field_foreign' => 'sliderwelcome' ], 'foreign_label' => 'title', 'foreign_sortby' => 'sorting', 'foreign_field' => 'uid_foreign', 'foreign_table_field' => 'tablename', 'appearance' => [ 'collapseAll' => 1, ], 'maxItems' => 999, 'enabledControls' => [ 'sort' => '1', 'delete' => '1', ], 'behaviour' => [ 'allowLanguageSynchronization' => 1, 'localizeChildrenAtParentLocalization' => 1 ], ] ],
Files
Updated by Oliver Hader over 7 years ago
- Is duplicate of Bug #80239: create new IRRE-Element cause exception in multi-language-evoirement added