Project

General

Profile

Actions

Bug #91852

closed

'l10n_display' => 'defaultAsReadonly' not working with mm table

Added by alejandro antolinez almost 4 years ago. Updated over 2 years ago.

Status:
Closed
Priority:
Should have
Assignee:
-
Category:
Localization
Target version:
-
Start date:
2020-07-23
Due date:
% Done:

0%

Estimated time:
TYPO3 Version:
10
PHP Version:
7.4
Tags:
Complexity:
Is Regression:
Yes
Sprint Focus:

Description

Hi
in my TCA I have a field of type select with an mm relation.

I am using 'l10n_mode' => 'exclude' and 'l10n_display' => 'defaultAsReadonly' and I would expect to see all the relations of the original record in my translated one, too.
Instead I get only one entry in the select field. Exactly that one with the id of how many relations are in the original record.
This is propably because the mm relation is not resolved in the translated record, but the value of the mm-field of the original record is taken (which is the count of relations).
In the files you see in the left the traduction in the righ the original language.

One example of config in tca

        'focus' => [
            'exclude' => false,
            'l10n_mode' => 'exclude',
            'l10n_display' => 'defaultAsReadonly',
            'label' => 'LLL:EXT:kultura/Resources/Private/Language/locallang_db.xlf:tx_kultura_domain_model_spectacle.focus',
            'config' => [
                'type' => 'select',
                'renderType' => 'selectMultipleSideBySide',
                'foreign_table' => 'tx_kultura_domain_model_focus',
                'foreign_table_where' => 'AND tx_kultura_domain_model_focus.sys_language_uid=0 AND {#tx_kultura_domain_model_focus}.{#pid}=###PAGE_TSCONFIG_ID###',
                'MM' => 'tx_kultura_spectacle_focus_mm',
                'size' => 10,
                'autoSizeMax' => 30,
                'maxitems' => 9999,
                'multiple' => 0,
                'fieldControl' => [
                    'editPopup' => [
                        'disabled' => false,
                    ],
                    'addRecord' => [
                        'disabled' => false,
                        'options' => [
                            'pid' => '###PAGE_TSCONFIG_ID###',
                        ]
                    ],
                    'listModule' => [
                        'disabled' => true,
                    ],
                ],
            ],

        ],

its the same issues that Bug #54093: 'l10n_display' => 'defaultAsReadonly' not working with mm table

Maybe a regression

Thanks


Files

localisation.png (119 KB) localisation.png alejandro antolinez, 2020-07-23 14:55

Related issues 2 (0 open2 closed)

Related to TYPO3 Core - Bug #54093: 'l10n_display' => 'defaultAsReadonly' not working with mm tableClosed2013-11-29

Actions
Related to TYPO3 Core - Bug #89152: renderType='selectTree' generates warning with single value selectClosed2019-09-11

Actions
Actions #1

Updated by alejandro antolinez over 3 years ago

  • Related to Bug #54093: 'l10n_display' => 'defaultAsReadonly' not working with mm table added
Actions #2

Updated by Christoph Lehmann over 3 years ago

I digged a little bit into it.

In SingleFieldContainer.php itemFormElValue is set to the value of the defaultLanguage (array of ids). These ids needs to be overlayed.

        // 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')
            && $isOverlay
        ) {
            $parameterArray['fieldConf']['config']['readOnly'] = true;
            $parameterArray['itemFormElValue'] = $this->data['defaultLanguageRow'][$fieldName];
        }

Initially $this->data['defaultLanguageRow'][$fieldName] is set in TcaSelectItems.php around line 99:

$result['databaseRow'][$fieldName] = $this->processSelectFieldValue($result, $fieldName, $itemArray);

These Ids are later compared and selected in SelectMultipleSideBySideElement.php

        foreach ($selectedItems as $itemValue) {
            foreach ($possibleItems as $possibleItem) {
                if ($possibleItem[1] == $itemValue) {
                    $title = $possibleItem[0];
                    $listOfSelectedValues[] = $itemValue;
                    $selectedItemsHtml[] = '<option value="' . htmlspecialchars((string)$itemValue) . '" title="' . htmlspecialchars((string)$title) . '">' . htmlspecialchars($this->appendValueToLabelInDebugMode($title, $itemValue)) . '</option>';
                    break;
                }
            }
        }

Instead of overlaying these ids it may work when the select items contain the id of the default language (and the translated titles).

As an acceptance critera also non-translated items should be visible in this readonly field.

Actions #3

Updated by Oliver Bartsch over 2 years ago

  • Status changed from New to Closed

Hi, this has been fixed with #89152. Therefore, I'll close this issue now. In case you still encounter similar problems, please create a new issue with reference to this one.

Actions #4

Updated by Oliver Bartsch over 2 years ago

  • Related to Bug #89152: renderType='selectTree' generates warning with single value select added
Actions

Also available in: Atom PDF