Codify mechanism to set a forward revision as the default revision

Created on 24 April 2015, over 9 years ago
Updated 16 June 2023, over 1 year ago

Problem/Motivation

The ability to save forward revisions was added in #218755: Support revisions in different states and—while it is not utilized by Core's UI—contrib modules are now able to save new draft revisions without unpublishing the currently published revision, or implementing unwieldy hacks. However, in the discussion of #2429153: On node revision overview, use 'Set current' if revisions are newer than current version it was indicated that there is currently no officially supported mechanism in Core to set a forward revision to be the current revision. This seems like a major oversight.

The expectation for any module implementing content moderation is that a forward revision can be simply set as the default (a.k.a. "current") revision, without creating a new revision, or changing the content of said revision. It seems like this should be possible by loading a forward revision and saving the entity, setting $newRevision = FALSE and $isDefaultRevision = TRUE. However, this method does not appear to be documented, or included in any tests, so it's function and support is questionable.

Proposed resolution

Either confirm that the above method is the official way to set a forward revision as the default revision and create tests to enforce that behavior, or provide an alternate method to set a forward revision as the default revision. However it is accomplished, this should update the base tables for the node and its associated fields to reflect the more current revision, without creating a new revision.

Remaining tasks

Do all the things.

User interface changes

Core does not currently utilize forward revision functionality, so no changes to the UI are anticipated. However, it may impact how #2429153: On node revision overview, use 'Set current' if revisions are newer than current version is implemented.

API changes

New tests are needed, but at this time no changes to the underlying API are anticipated.

📌 Task
Status

Closed: outdated

Version

11.0 🔥

Component
Entity 

Last updated about 3 hours ago

Created by

🇺🇸United States jstoller

Live updates comments and jobs are added and updated live.
  • Needs tests

    The change is currently missing an automated test that fails when run with the original code, and succeeds when the bug has been fixed.

  • Usability

    Makes Drupal easier to use. Preferred over UX, D7UX, etc.

Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024