#77257The selection of a selectbox with the l10n_display type of defaultAsReadonly in TCA is wrong for a localized record
Description
If a non-translatable selectbox is rendered within a localized record with defaultAsReadonly type for l10n_display only the first character of the selected uid is used to set the selected value. The problem is in line 95 of the SelectSingleElement class:
if (!empty($parameterArray['itemFormElValue'])) {
$selectedValue = (string)$parameterArray['itemFormElValue'][0];
}
An array is expected here but in this case, a localized item with a non-translatable select field, the value of itemFormElValue is a string.
Here is an example for the TCA config:
'foo' => array(
'l10n_mode' => 'exclude',
'l10n_display' => 'defaultAsReadonly',
'config' => array(
'type' => 'select',
'renderType' => 'selectSingle',
'foreign_table' => 'tx_example_domain_model_foo'
)
)Reviews 2
Related issues 4
- Bug #77155PHP Warning: Invalid argument supplied for foreach() in backend/Classes/Form/Element/SelectMultipleSideBySideElement.php line 66
- Bug #81996Read-only select field 'renderType' => 'selectSingle' renders all available items
- Bug #82843TCA: localized `SelectSingleElement` selects wrong option
- Bug #84997Localized records with rendertype selectCheckBox + defaultAsReadonly generate PHP warnings