Problem/Motivation
Even when access is denied to a widget, the value submitted propagates to the entity built from the sum of widgets.
Steps to reproduce
- Enable at least content translation and content moderation modules and some entity providing module, node is typical.
- Set
Hide non translatable fields on translation forms
on the content translation admin form. - Create an entity.
- Now add a nontranslatable field with a non-null default value.
- Try to add a non-default revision translation of the entity.
- Kaboom courtesy of EntityUntranslatableFieldsConstraint as the non-null value changes to the default. (error message "Non-translatable fields can only be changed when updating the original language.")
Proposed resolution
Don't let widgets pass their values when access is denied to them.
Remaining tasks
User interface changes
API changes
Data model changes
Release notes snippet
Original report by pavlosdan
We use *Paragraphs + Content Moderation + Translations*. We have a lot of content that is moderated and translated. We've added a new field in one of the paragraphs that did not need to be translatable (it's a checkbox that should be the same across translations) but we noticed that if a user attempts to edit existing published translated content holding said paragraph type prior to the original having a value for that field then the system throws a "Non translatable fields can only be changed when updating the current revision" error.
So far the only workarounds we could think of was to make the field translatable even though it didn't need to be.
Another possibility would be to remove the constraint as suggested here: https://www.drupal.org/project/drupal/issues/2955321#comment-12541730 but we didn't test this.
Your thoughts on this would be greatly appreciated. :)