I have a question about the 8.3 Content Moderation module. In pre-8.3 Content Moderation, you can edit the machine names of the states because you can have duplicate state labels. In the 8.3 version (interactive demo), I didn't see the means by which you can edit the state's machine name when you add a state. Will we be able to have duplicate state labels? If so, we'll need the ability to change the state's machine name. This is important, because I need the ability to create a new draft of a published item, as well as un-publish a published item and put it back to a draft state. I don't want to archive it - archive has a very different business meaning from un-publishing something that was published erroneously. In order to accomplish that, I would have 2 different Draft states - one is the default revision, the other is not. But I want both to have a label of Draft. I voiced this concern in the original issue in which this new version was documented. My comment was #65:HERE
Thanks!
Comments
Comment #2
timmillwoodYou can edit a machine name when creating a new state, but not after the state is saved. This allows you to do as you say and have the default "Draft" state, then have another "Draft" state with the machine name "draft_published" for example. This allows you to have an unpublished draft state and a published draft state, which I think is what you're looking to do.
Although, I'm really confused as to the use case of having a published draft state, and also don't you think to states with the same label would get awfully confusing?
Comment #3
alexpott@timmillwood I'm guessing everything is controlled via transitions so it is not confusing. It is totally possible to create a workflow that has three states:
And then enforce the content entities start in draft_default and can only move to draft_default or published. Once the state is moved published then it can only move to draft_not_default or published. This type of workflow is not strictly necessary because the way the entity system works is that until there is a default revision the latest revision is the default revision. This is the way the workflow that comes with core works. There is no need for draft_default. However it is totally possible if you want it.
Comment #4
timmillwood@alexpott - Right, the transitions will make this a lot less confusing. As we discussed on IRC I think the only place this becomes confusing is if you have states listed somewhere, such as Views exposed filters, or checkboxes. As we concluded, this could be confusing, but could work, and is not broken.
Comment #5
scookie commented@timmillwood - regarding your comment in #2: "Although, I'm really confused as to the use case of having a published draft state, and also don't you think to states with the same label would get awfully confusing?"
I'm not saying I want a published draft state.
I'm saying I want one draft state (unpublished) flagged as the default revision, and one draft state (unpublished) NOT flagged as the default revision. Both of those states would have a label of Draft, but they would have different machine names.
The only question I had was for the ability to edit the machine name of a state. I was under the impression that you could NOT edit the machine name when you created a state. As long as I can edit that machine name when I create it, then I'm good. :-)
And just for clarification regarding what I'm doing, I have the following scenario - very close to what @alexpott is talking about in his example #3, but I DO need both draft states. I need both draft states, because once an item is published, I need the ability to either create a new draft while keeping the published version published, or un-publish that item and return it to draft because it was published prematurely. Here's how I've defined the states and transitions:
States
Draft (draft_default): unpublished, default revision = yes
Draft (draft_not_default): unpublished, default revision = no
Published (published): published, default revision = yes
Transitions
Keep in draft (keep_in_draft_default): From Draft (draft_default) To Draft (draft_default)
Keep in draft (keep_in_draft_not_default): From Draft (draft_not_default) To Draft (draft_not_default)
Publish (publish_default): From Draft (draft_default) To Published (published)
Publish (publish_not_default): From Draft (draft_not_default) To Published (published)
Keep published (keep_published): From Published (published) To Published (published)
Create new draft (create_new_draft): From Published (published) To Draft (draft_not_default)
Unpublish, return to draft (unpublish_return_to_draft): From Published (published) To Draft (draft_default)
It's those last 2 transitions that cause me to need 2 draft states. And since we're displaying the state of an item in various places, I want the state's label to say Draft, regardless of whether it's the default revision or not; hence the duplicate state labels.
I hope that clarifies my question (can you edit the machine name?). Sorry for any confusion.
Comment #6
alexpott@scookie - there is no way to edit a machine name of a state once it exists - but why do you want to? As @timmillwood says when you create a state you can set the machine name to whatever you like. The reason you can't change a machine name of state once it exists is we don't have any way of managing the affect this would have on existing entities. You can have as many duplicate labels as you like.
Funnily enough what you're use-case does outline is that I think the actions belong on the transitions not the states and then you'd actually need less states and transitions.
Comment #7
scookie commented@alexpott, I'm sorry, you misunderstood me.
In my original question, I said "...I didn't see the means by which you can edit the state's machine name when you add a state.".
I was under the impression that you could not change the machine name at the time you create that state.
I was wrong - you can.
I don't need to edit it once it exists.
Regarding my use case, can you please show me an example of how, when an item is published, I can have a choice of either creating a new draft or unpublishing an item if I only have 1 draft state.
Thanks!
Comment #8
alexpott@scookie well that does not exist at the moment but if the we could put the entity manipulation we'd have:
States
Draft (draft)
Published (published)
Transitions
Keep in draft (keep_in_draft): From Draft (draft) To Draft (draft) : no changes
Publish (publish): From Draft (draft) To Published (published) : Publish new revision and make it default revision
Keep published (keep_published): From Published (published) To Published (published) : Publish new revision and make it default revision
Create new draft (create_new_draft): From Published (published) To Draft (draft) : Unpublish new revision and don't change default revision
Unpublish, return to draft (unpublish_return_to_draft): From Published (published) To Draft (draft) : Unpublish new revision and make it the default revision
Comment #9
scookie commented@alexpott, so what you're saying is that the ability to do what I need doesn't exist at the moment.
I need it to exist in 8.2.x.
And that is why I need 2 draft states. Unless someone is planning on building some other way for me to indicate that one transition from draft to published creates a new draft, while another transition from draft to published un-publishes it and makes draft the default revision, I can only accomplish my goal by having 2 draft states.
Comment #10
sam152 commentedWhy not make things easier and come up with some different terminology to represent the state of draft-unpublished? Recalled? Needs work? Unpublished Draft?
Comment #11
scookie commented@Sam152, I don't know what you mean by "make things easier". I don't want different terminology. As an end user, when an item is in the state labelled Draft, I don't care whether it's an unpublished version of a published item, or if it's an unpublished item that was either never published, or had previously been published and got "un-published". I want it to be called Draft.
I can "unpublish" a published item at different times during its workflow. I can also create a new draft while keeping the item published. Regardless of whether I want to create a new draft or unpublish it and put it back into a draft state, I want that state to be labeled Draft.
But let's run with your suggestion. Let's say that my "normal" workflow has these states:
Draft, In Review, Ready to Publish, Published
In your example, what states would I have?
Draft (unpublished, not the default revision)
In Review (unpublished, not the default revision)
Ready to Publish (unpublished, not the default revision)
Published (published, IS the default revision)
Recalled (unpublished, IS the default revision)
When I transition from Published to Draft, it creates a new draft while leaving the item published, because Draft is not the default revision.
When I transition from Published to Recalled, it un-publishes the item and puts it an unpublished state, because Recalled IS the default revision.
So now that i have an unpublished version in a state of Recalled, what does my workflow look like to get it published? I still need to take it through In Review and Ready to Publish before I publish the thing. But I'll need versions of those unpublished states that ARE the default revision in order to get it through the workflow. So how is your suggestion making things easier? I would have to have state labels something like "Recalled - Draft", "Recalled - In Review", "Recalled - Ready to Publish". Our users would find that very confusing. Again, they don't care whether something was previously published and then became un-published. All they care about is what state it is in at a given time: Draft, In Review, Ready to Publish, or Published.
Comment #13
sam152 commentedNot true, the "Recalled" state can remain the default (and unpublished) revision right up until the content is ready to be published. When admins are viewing/reviewing the content, they can use the latest-version route and end users wont know the difference, to them the content will just be unpublished.
Comment #16
timmillwood