Check if entities are revisionable before creating revision

Created on 3 July 2025, 9 days ago

Problem/Motivation

✨ Support creating a revision and setting revision log message Active was a great addition. I just thought, after merging and tagging it, that it might fail on entities that don't have revisions enabled.

I don't know if it'll be a graceful fail (do nothing) or a hard fail (throw exception), so let's use this to test this case and fix it if needed.

Steps to reproduce

Use the new revision fields on non-revisionable entities.

Proposed resolution

Use the "isRevisionable" method before setting the revision fields.

if ($this->entityType->isRevisionable()) {
...

If entities are not revisionable, we should probably add something via the messenger service to let users know about it (eg: "We could not create a revision on X because it's not configured to be revisionable").

Remaining tasks

Test and MR.

πŸ› Bug report
Status

Active

Version

2.0

Component

Code

Created by

πŸ‡ͺπŸ‡ΈSpain fjgarlin

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

  • Issue created by @fjgarlin
  • πŸ‡ΊπŸ‡ΈUnited States bkosborne New Jersey, USA

    I thought this to, but the action plugin this module provides is currently applicable to nodes, which all have revision support.

    So I think we can close this, or perhaps we change this issue to make the module work with other entity types? Though, at the moment I have no need for that, and prefer to keep the module as simple an narrow in scope as possible. There is Views Bulk Edit β†’ that works with all entity types and has many more features that people could use as well.

  • πŸ‡ͺπŸ‡ΈSpain fjgarlin

    Agree to keep things simple. Thanks for confirming.

Production build 0.71.5 2024