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.