Localized records with rendertype selectCheckBox + defaultAsReadonly generate PHP warnings
If you open a localized records, which contains a field of type select and rendertype selectCheckBox, it will produce the following warning, if l10n_display is defaultAsReadonly:
Core: Error handler (BE): PHP Warning: array_flip() expects parameter 1 to be array, string given in [...]\typo3\sysext\backend\Classes\Form\Element\SelectCheckBoxElement.php line 71
#3 Updated by Michael Stopp 10 months ago
- File SelectCheckBoxElement_8.7.24.patch View added
- File SelectCheckBoxElement_9.5.4.patch View added
The cause of the warning is described in #87472. The fix proposed by Dmitry will remove the PHP warning, but the element will still not be rendered correctly with the current implementations (8 LTS, 9 LTS).
The $disabled flag (set by $config['readOnly']) will always leave the $groups checkbox array empty and thus the field will never be rendered properly. The disabled property in the items array is hardcoded to false, which makes this ternary operator further below a bit nonsensical:
($item['disabled'] ? 'disabled=disabled ' : '')
I suggest the enclosed patches for a readonly rendering of the SelectCheckBox element (as the defaultAsReadonly option in TCA would suggest...).