Problem/Motivation
When the content moderation and the content translation module are activated and want to transform an entity to translatable, the option "hide non translatable fields on translation forms" from the url "/admin/config/regional/content-language" is checked and the widget is disabled, so you can not change it.
I understand that this is because the non-translatable fields do not allow revisions.
On websites with multiple languages, where there can be one or more editors for a specific language, could be interesting to allow a second option: instead of hiding the fields, disable the non-translatable fields but showing the values, to give a clue of the default translation value to user editing the content.
It could be problematic with some custom or non-core widgets that don't support the "#disabled" attibute, but all or most of core Form API elements are compatible with the "#disabled" attribute.
Proposed resolution
- Give the option to disable non-translatable fields instead of hide non-translatable fields
- Disable non-translatable fields on entity translation edit/add form
-
Example of radiobuttons with content_moderation disabled:
- Example of radiobuttons with content_moderation enabled:
Remaining tasks
Create a patch.
User interface changes
On the mentioned admin form the options should change as well as the entity add/edit forms. See "Proposed resolution" section.
API changes
None.
Data model changes
The configurtion entity related to this form will change. This may need an update function.
Issue fork drupal-3222997
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #2
eduardo morales albertiComment #3
tunicComment #5
eduardo morales albertiComment #8
mauricio.galindo commentedA new option was added on /admin/config/regional/content-language

And with this option the fields are disabled on translatable content entities in the alter form only for translation forms
Comment #9
mauricio.galindo commentedComment #10
rinku jacob 13 commentedReviewed and tested the patch#8 for drupal 9.3.x-dev. It's look good for me. Thanks@mauricio.galindo. Adding screenshot for the reference.
Comment #11
rinku jacob 13 commentedComment #13
j-vee commentedTested and everything works well! Thanks for the patch.
Comment #14
Manibharathi E R commentedPatch #8 Applied and tested successfully on Drupal 9.4.x.
Before Patch:

After Patch:

Comment #15
jasonawantI came across this issue b/c I was looking for alternatives to the "Hide non translatable fields on translation forms" for entity reference fields.
I tested the above patch, but did not observe my expected "disable" behavior on the untranslatable fields. I've made suggested to the MR and uploaded a new patch with interdiff.
I think it an improvement for content authors that have previously experienced the hidden version. However, it's probably still confusing for content authors. May need to take this a step further an alter the "(all languages)" suffix added to field labels via ContentTranslationHandler::addTranslatabilityClue() here.
Comment #16
jasonawantComment #18
smustgrave commentedThis issue is being reviewed by the kind folks in Slack, #need-reveiw-queue. We are working to keep the size of Needs Review queue [2700+ issues] to around 400 (1 month or less), following Review a patch or merge require as a guide.
Tagging for needs tests
Comment #23
oily commentedTried to create a new 11.x branch using Drupal.org instructions but too many conflicts that had to be resolved by editing. Abandoned attempt.
Seems we need to create a new MR based on 11.x.
Comment #28
laurielim commentedCreated a branch from 11.x and applied the changes from patch #15 to the latest version.
Here is also a patch for 11.2.10, before content_translation.admin.inc deprecation.