function node_revision_list

Returns a list of all the existing revision numbers for the node passed in.

Parameters

\Drupal\Core\Entity\EntityInterface $node: The node entity.

Return value

An associative array keyed by node revision number.

1 call to node_revision_list()
node_revision_overview in drupal/core/modules/node/node.pages.inc
Page callback: Generates an overview table of older revisions of a node.

File

drupal/core/modules/node/node.module, line 1814
The core module that allows content to be submitted to the site.

Code

function node_revision_list(EntityInterface $node) {
  $revisions = array();
  $result = db_query('SELECT nfr.vid, nfr.title, nfr.log, nfr.revision_uid AS uid, n.vid AS current_vid, nfr.revision_timestamp, u.name FROM {node_field_revision} nfr LEFT JOIN {node} n ON n.vid = nfr.vid INNER JOIN {users} u ON u.uid = nfr.revision_uid WHERE nfr.nid = :nid AND nfr.default_langcode = 1 ORDER BY nfr.vid DESC', array(
    ':nid' => $node->nid,
  ));
  foreach ($result as $revision) {
    $revisions[$revision->vid] = $revision;
  }
  return $revisions;
}