I want to display a different "Submitted by" message for content that has been updated, and thus has multiple revisions.
How can I tell if I'm on the original revision, or if there are multiple revisions?
Drupal Answers is a question and answer site for Drupal developers and administrators. It only takes a minute to sign up.Sign up to join this community
NodeStorage::revisionIds() will let you retrieve all revisions of a node which will let you compare against the current node's version.
// Retrieve all vids. $nid = 123; $node = Drupal\node\Entity\Node::load($nid); $vids = \Drupal::entityTypeManager()->getStorage('node')->revisionIds($node); // Does the original node's vid match the current node's vid? return (reset($vids) == $node->vid->getString());