There is a bug in the logic which decides to prevent the user from unchecking the Publish this translation checkbox.
<!--break-->
What are the steps required to reproduce this bug?
- Create a
media
entity and save it as published
- Create a translation of the entity
What behavior were you expecting?
First of all, I wasn't expecting to see the Publish this translation checkbox at all, since (in our own case), the content type is connected with a moderation workflow, which takes over control of the status
field, but that's a problem which probably needs to be
addressed β
by the content_moderation
module. Another reason I didn't expect to see the checkbox was because it's not there on the form for a node
entity (the node
module removes that field from the form in an entityFormAlter()
method), which is why this repro case specifies a media
entity.
Second, I was surprised to see that the default for the checkbox field was checked. But that's just because I haven't yet found the documentation which explains that the default for a new translation of an entity is that it will be published. (If some kind soul could provide the link to that documentation, I'd be grateful).
Third, I did not expect to see that the checkbox was disabled.
What happened instead?
The "Publish this translation" checkbox appears, is checked, and is disabled.
The first two points are provided in order to give a complete answer to the What behavior were you expecting? question, but they're not the bug I'm reporting. The last bit is the bug. The comment in the code indicates that the intention is to prevent removal of the only remaining published translation of an entity, but the code thinks that the translation being saved is published even when it isn't. In fact, you'll run into this same bug whether you set the original-language version of the entity as published or unpublished.
I'll attach a patch as soon as I get an issue number which I can embed in the patch file name.