Since "Support revisions in different states" went into the core it is now theoretically possible to have forward revisions of nodes. For example publish revision 1 then create revision 2 but keep it unpublished. This is very useful when someone needs to create new version of a node that needs to be approved before publishing.

Sounds great so here's what I did:

  1. I've created a node with title "Published revision". The node ID is 1 and it's revision is 1.
  2. I've created a new revision of node 1 and changed it's title to "Unpublished revision". This node has revision 2 and it has immediately been set as default revision.
  3. At this moment /node/1 shows the node with title "Unpublished revision".
  4. I've used PHP to load node 1 with revision 1 and I've set it to default revision ($node->isDefaultRevision(true)).
  5. At this moment /node/1 shows the node with title "Published revision".

So far so good. However the problem is that I'd like to edit revision 2 but I can't:

  1. /node/1/edit shows edit form of revision 1.
  2. /node/1/revisions/2/edit is of course 404.
  3. And on top of that when I go to /node/1/revisions the revision 2 is listed as "Current" which of course is not true because default revision is 1. (Let's say I can live with that for now)


  1. How to edit arbitrary node revision?
  2. How to control which node revision is saved as default revision?

1 Answer 1


It sounds like you want to use content_moderation experimental module that just went into Drupal Core 8.2.x-dev and will be available in Drupal 8.2.0.

That module should also be a great inspiration how to implement the functionality.

In general you will need to create your own route where you first load the revision of the entity, then save it when you get it back from the form with:

$node->setNewRevision(); $node->isDefaultRevision(FALSE);

The function name is very misnamed (https://www.drupal.org/node/2706337 has the details).

However I strongly suggest to check content_moderation first and maybe you can just utilize it for your needs directly.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.