Issue Bug Closed

#76785Wrong Selected option in localised TCA columns of type select when l10n_mode="exclude"

Jeffrey Nellissen 06/24/16, 14:30 updated 04/01/20, 21:14

Description

If l10n_mode is set to exclude, the selected field in localised elements is wrong.
In this case the variable $parameterArray[‘itemFormElValue’] seems to be a string, not an array as expected in SelectSingleElement.php
In fact T3 will take only the first letter as related uid for translated record
aE Default Element has a relation to an element with uid 37, select field of translated record will shown the element with the uid 3 as selected option

Workaround for me is currently:

change

        if (!empty($parameterArray['itemFormElValue'])) {
            $selectedValue = (string)$parameterArray['itemFormElValue'][0];
        }

to

       if (!empty($parameterArray['itemFormElValue'])) {
                if (is_array($parameterArray['itemFormElValue'])){
                        $selectedValue = (string)$parameterArray['itemFormElValue'][0];
                } else {
                        $selectedValue = (string)$parameterArray['itemFormElValue'];
                }
        }

in ../sysext/backend/Classes/Form/Element/SelectSingleElement.php on line 94 ff

But im wondering, if it should be better to fix this in the method, which fill the $parameterArray for exclude Elements

Best regards,
Jeffrey

Reviews 2