Skip to content
Snippets Groups Projects
Commit a9ef5b97 authored by Oliver Bartsch's avatar Oliver Bartsch
Browse files

[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: default avatarcore-ci <typo3@b13.com>
Tested-by: default avatarOliver Bartsch <bo@cedev.de>
Reviewed-by: default avatarOliver Bartsch <bo@cedev.de>
parent 778df50b
Branches
Tags
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment