- Issue created by @sassafrass
- πΊπΈUnited States sassafrass
Note: The cryptic message in step 2. says, "'The scheduled publishing state of Publish is not a valid transition from the current moderation state of Publish for this content.';" which is generated by the Drupal\scheduler_content_moderation_integration\Plugin\Validation\Constraint\ PublishStateConstraint class.
- πΊπΈUnited States sassafrass
Actually... this may be even more significant than i initially thought. It seems that any Scheduled content cannot change its moderation state from the Latest Revision Form page. The state can only be changed from the node edit page.
- πΊπΈUnited States sassafrass
I believe some of the errors I was experiencing have to do with somehow being able to not set the Published state and still schedule the content...which results in a cron error. I'm still investigating with my client.
- πΊπΈUnited States sassafrass
I believe I have narrowed this down. The use case is specific to directly Publishing a scheduled piece of content. If the Moderation transition from Published to Published is not allowed, you get an error preventing you from directly publishing from the Node edit form. Nothing is changed. However, under the following scenario, content can be put in an unexpected state.
If you use the Node Revision Form and the Moderation transition from Published to Published IS NOT allowed by your workflow, the user is not prevented from selecting the Publish state. It appears successful except:
- The Content Overview page shows the content as Unpublished.
- The Node edit form shows the content as Published and hides the Publish on fields even though they are still set.
- The Content Moderation page no longer displays the content.
- The Scheduled Content page shows the content as still Scheduled.
- Cron runs continually fail.
If the Moderation transition from Published to Published IS allowed by your workflow, the user is not prevented from selecting the Publish state. It appears successful except:
- The Content Overview page shows the content as Unpublished.
- The Node edit form shows the content as Published and hides the Publish on fields even though they are still set.
- The Content Moderation page no longer displays the content.
- The Scheduled Content page shows the content as still Scheduled.
- Cron runs fail until the original content Scheduled time.
- πΊπΈUnited States sassafrass
I have tried to add a hook_form_alter to the content_moderation_entity_moderation_form to add a custom validator that includes the PublishStateConstraintValidator from Drupal\scheduler_content_moderation_integration\Plugin\Validation\Constraint. Unfortunately, the PublishStateConstraintValidator expects the $value to come from the entity as opposed to the form. As a result, it is getting the current moderation_state from the node entity, rather than the new_state from the content_moderation_entity_moderation_form.
Without knowing what direction this module is planning on taking with respect to direct publishing of content, I don't know how best to contribute at this point.