Add a method for checking if an entity allow revisions

Created on 18 February 2016, over 8 years ago
Updated 12 August 2024, 3 months ago

Problem/Motivation

ContentEntityInterface implements RevisionableInterface, but not all of the RevisionableInterface support revisions (e.g: taxonomy terms).
Before calling $entity->setNewRevision(FALSE); we should check if the entity allows revisions or not with $entity->getEntityType()->hasKey('revision').

Proposed resolution

a) Add a method RevisionableInterface::isRevisionable() that hides the implementation detail
or
b) Anyone would assume that objects implementing RevisionableInterface support revisions. Use it only where is needed, and use a trait if possible instead of having the implementation in ContentEntityBase.

Remaining tasks

Discuss

User interface changes

None.

API changes

Ideally, API additions only, so eligible for 8.1.0.

Data model changes

None.

📌 Task
Status

Closed: works as designed

Version

11.0 🔥

Component
Entity 

Last updated about 3 hours ago

Created by

🇪🇸Spain penyaskito Seville 💃, Spain 🇪🇸, UTC+2 🇪🇺

Live updates comments and jobs are added and updated live.
  • DrupalWTF

    Worse Than Failure. Approximates the unpleasant remark made by Drupal developers when they first encounter a particular (mis)feature.

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