The moderation state select element uses (Current) in the option label to mark the current state.
The problem
When the current state is Published this element incorrectly marks the default ('Draft' in this case) state as current.
Expected behavior
The expected behavior is that the (Current) indicator should ALWAYS show the current state.
Why is this happening?
There is some code that appears to be making this change on purpose, causing the wrong version to be labeled "Current"
// We have a use case where a published node is being edited. This will always
// revert back to the original node status.
if ($moderation_state == content_moderation_state_published()) {
$moderation_state = content_moderation_state_none();
}
Related but perhaps not the same:
Ideally the default value for the select list would also be the current state. I'm not sure I understand the use-case of having the select list not match reality? I think I understand now, people using the "New Draft" tab might be expecting to create a new draft, instead of editing the published node.
But then how would one edit the published node (thus creating a new, published revision) without creating a new draft revision first? Hitting Edit and then Save (without intentionally changing anything) could accidentally end up in Published content being reverted to Draft state.
I would recommend we remove this section of code entirely. If the use-case described in the code comment pops up again, we can better document what it is exactly, what is expected in that scenario, and implement a solution that won't affect everyone else negatively
I would recommend that we label the current state correctly in the select list. Other changes may need further discussion!
The moderation state select element uses
(Current)in the option label to mark the current state.The problem
When the current state is
Publishedthis element incorrectly marks the default ('Draft' in this case) state as current.Expected behavior
The expected behavior is that the
(Current)indicator should ALWAYS show the current state.Why is this happening?
There is some code that appears to be making this change on purpose, causing the wrong version to be labeled "Current"
Related but perhaps not the same:
Ideally the default value for the select list would also be the current state.
I'm not sure I understand the use-case of having the select list not match reality?I think I understand now, people using the "New Draft" tab might be expecting to create a new draft, instead of editing the published node.But then how would one edit the published node (thus creating a new, published revision) without creating a new draft revision first? Hitting
Editand thenSave(without intentionally changing anything) could accidentally end up in Published content being reverted to Draft state.I would recommend we remove this section of code entirely. If the use-case described in the code comment pops up again, we can better document what it is exactly, what is expected in that scenario, and implement a solution that won't affect everyone else negativelyI would recommend that we label the current state correctly in the select list. Other changes may need further discussion!