Active
Project:
Drupal core
Version:
main
Component:
entity system
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
21 Jan 2022 at 11:23 UTC
Updated:
24 Nov 2022 at 13:28 UTC
Jump to comment: Most recent
RevisionableInterface::isLatestRevision returns FALSE on hook_entity_update() and hook_ENTITY_TYPE_update() implementations for new revisions. It should return TRUE.
Starting from a fresh 9.3 Drupal installation with standard profile, add a basic hook_ENTITY_TYPE_update() implementation like:
function <MY_CUSTOM_MODULE>_node_update(NodeInterface $node) {
\Drupal::messenger()->addWarning($node->isLatestRevision() ? t('This is the latest revision') : t('This is NOT the latest revision'));
}
Create a new revision for an existing article. The "This is NOT the latest revision" message is shown.
TBD.
TBD.
N/A
N/A
N/A
TBD.
Comments
Comment #3
rp7 commentedI can confirm that this issue exists. Anyone has a workaround on how to figure out whether the entity in hook_entity_update() is the latest revision?
Comment #6
almunningsAs a possible workaround short-term, I've had luck with this: