Project

General

Profile

Actions

Bug #81315

closed

Translation of inline elements fails, when only one item is to be translated

Added by Robert Becker over 7 years ago. Updated over 7 years ago.

Status:
Closed
Priority:
Must have
Assignee:
-
Category:
FormEngine aka TCEforms
Target version:
-
Start date:
2017-05-23
Due date:
% Done:

0%

Estimated time:
TYPO3 Version:
8
PHP Version:
Tags:
Complexity:
Is Regression:
Sprint Focus:

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

fix.patch (927 Bytes) fix.patch Robert Becker, 2017-05-23 16:23

Related issues 1 (0 open1 closed)

Is duplicate of TYPO3 Core - Bug #80239: create new IRRE-Element cause exception in multi-language-evoirementClosedOliver Hader2017-03-11

Actions
Actions

Also available in: Atom PDF