Bug #84997
closed
Localized records with rendertype selectCheckBox + defaultAsReadonly generate PHP warnings
Added by Michael Stopp over 6 years ago.
Updated over 4 years ago.
Category:
FormEngine aka TCEforms
Description
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
Files
- Related to Bug #77257: The selection of a selectbox with the l10n_display type of defaultAsReadonly in TCA is wrong for a localized record added
- Related to Bug #87472: PHP warning with checkboxes and l10n_display=defaultAsReadonly 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...).
- Status changed from New to Under Review
- Status changed from Under Review to Resolved
- % Done changed from 0 to 100
- Status changed from Resolved to Under Review
- Status changed from Under Review to Resolved
- Status changed from Resolved to Closed
Also available in: Atom
PDF