Issue Bug Closed

#77257The selection of a selectbox with the l10n_display type of defaultAsReadonly in TCA is wrong for a localized record

M. Stichweh 07/26/16, 12:39 updated 04/01/20, 21:14

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