- Issue created by @krisahil
With both content_moderation and workspaces, the node edit form presents the canonical/published revision, not the latest revision.
Expected behavior:
- Create a node and set the initial revision as published.
- Edit the node and set the next revision as un-published.
- Edit the node again.
- Notice that you are editing the latest revision, which is un-published.
Actual behavior:
- With both content_moderation (CM) and workspaces enabled AND the default CM workflow set to apply to all content types:
- Create a node and set the initial revision as published.
- Edit the node and set the next revision as un-published.
- Edit the node again.
- Problem: Notice that you are editing the original, published revision, not the latest revision.
I think this is what is happening:
- When you request /node/1/edit, the route param converter (\Drupal\Core\ParamConverter\EntityConverter::convert
) tries to convert the entity ID "1" to the loaded entity.
- Because content_moderation has set that all entities in its workflows use should route param load_latest_revision=true
(see \Drupal\content_moderation\Routing\ContentModerationRouteSubscriber::setLatestRevisionFlag
), the route param converter tries to load the entity with $this->entityRepository->getActive()
.
- At this point, Workspaces's (decoration) entity repository service is called (\Drupal\workspaces\WorkspacesEntityRepository::getActive
).
- Because there is not an active workspace, this method doesn't load the active revision, e.g., the draft node. Instead, it changes course and loads the canonical revision (getCanonical()
). This results in loading the original, published revision of the node, not the latest draft revision.
This behavior seems to have been introduced in π The active variant of an entity in the Live workspace should be the default revision Active , which is part of core 11.2.
I don't know. Is this behavior intentional?
Active
11.2 π₯
workspaces.module