Problem/Motivation
For a long time content_moderation
has always created a new revision when saving a moderated entity and controlled the publishing and defaultness of that revision according to the configured moderation workflow.
There are some cases where a moderated entity might require non-content related metadata to be updated, content to be synced into a particular revision from some other source (such as the lingotek module syncing translation information into a particular entity translation revision) or updated via a workspaces deployment in the future: #3037136: Make Workspaces and Content Moderation work together.
Proposed resolution
It would be a significant change in the API to switch off new revisions by default for content moderation, but we can leverage SynchronizableInterface
to provide an API to opt out of specifically the semantics of:
- Forcing a new revision every save.
- Adjusting the default status of the revision being saved.
Specifically while syncing, changes to the moderation state itself:
- Will still be reflected.
- Will still update the 'publishing' status of the revision according to the given workflow.
Remaining tasks
User interface changes
API changes
Data model changes
Release notes snippet
New revisions are created every time an entity or revision is updated, if that entity is being moderated with content moderation. Previously there was no way to opt out of this. By using SynchronizableInterface
, users can now mark an entity as 'syncing' to indicate changes are being made to the entity that do not reflect a typical content/editorial field based change and thus should not be subject to the entity lifecycle rules content moderation enforces. If you are using SynchronizableInterface
in custom code for content entities and also depend on content moderation forcing the creation of new revisions, you may need to update your code to manually call $entity->setNewRevision(TRUE).