[BUGFIX] Properly handle l10n_display=displayAsReadonly
TCA provides the "l10n_display" configuration, which allows to define how TCA fields should behave in localizations. One of the possible values is "defaultAsReadonly", which just renders the default records value in a readonly field. This is non functional and only used in FormEngine. Common use cases are fields, which do not change in a localization, e.g. the author of a blog article. How did this work? The SingleFieldContainer, entry point of each TCA field, checked whether the option is set and if so, overrides the "itemFormElValue" - containing the processed database field value - with the raw field value of the default record and automatically sets the field to "readOnly". This already worked for basic types, such as "input", "check" or "radio", since their database values are usually not further processed by any form data provider. However, when it comes to types, dealing with relations or enrichments, just using the default records' raw database value did mostly not work. Therefore, this patch removes the replacement from SingleFieldContainer and adds a new form data provider, dealing with this task. This way, we ensure all following data providers can process the correct value (either the current database value or the default records value). This can be tested with a new styleguide record: https://github.com/TYPO3/styleguide/pull/254 For some cases (mostly MM lookups and inline), the "l10n_mode" needs to be set to "exclude", when using "defaultAsReadonly", since otherwise the DataHandler doesn't hold the relations in sync. Note: TCA type "slug" and TCA renderType "belayoutwizard" do not yet handle readOnly at all, because this option is not supported as "columns config". This is fixed in two separate patches (#96096 and #96095). Note: TCA type "flex" does still not work, since the corresponding containers do not implement readOnly handling at all. Fixing this will be done in a separate patch. Resolves: #89152 Related: #96095 Related: #96096 Releases: main, 11.5 Change-Id: Ic5346606c0309784a689c83dcefd1888bf31fc89 Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/72414 Tested-by:core-ci <typo3@b13.com> Tested-by:
Oliver Bartsch <bo@cedev.de> Reviewed-by:
Oliver Bartsch <bo@cedev.de>
Showing
- typo3/sysext/backend/Classes/Form/Container/SingleFieldContainer.php 1 addition, 1 deletion...t/backend/Classes/Form/Container/SingleFieldContainer.php
- typo3/sysext/backend/Classes/Form/Element/SelectCheckBoxElement.php 3 additions, 9 deletions...xt/backend/Classes/Form/Element/SelectCheckBoxElement.php
- typo3/sysext/backend/Classes/Form/Element/SelectSingleBoxElement.php 1 addition, 1 deletion...t/backend/Classes/Form/Element/SelectSingleBoxElement.php
- typo3/sysext/backend/Classes/Form/Element/TextTableElement.php 1 addition, 1 deletion.../sysext/backend/Classes/Form/Element/TextTableElement.php
- typo3/sysext/backend/Classes/Form/FieldControl/ResetSelection.php 5 additions, 2 deletions...sext/backend/Classes/Form/FieldControl/ResetSelection.php
- typo3/sysext/backend/Classes/Form/FormDataProvider/DatabaseRowDefaultAsReadonly.php 64 additions, 0 deletions...es/Form/FormDataProvider/DatabaseRowDefaultAsReadonly.php
- typo3/sysext/backend/Tests/Unit/Form/FormDataProvider/DatabaseRowDefaultAsReadonlyTest.php 185 additions, 0 deletions...orm/FormDataProvider/DatabaseRowDefaultAsReadonlyTest.php
- typo3/sysext/core/Configuration/DefaultConfiguration.php 12 additions, 2 deletionstypo3/sysext/core/Configuration/DefaultConfiguration.php
Please register or sign in to comment