1 node.module node_revision_list(Node $node)

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


Node $node: The node entity.

Return value

An associative array keyed by node revision number.:


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


function node_revision_list(Node $node) {
  $revisions = array();
  $result = db_query('SELECT r.vid, r.title, r.log, r.uid, n.vid AS current_vid, r.timestamp, u.name FROM {node_revision} r LEFT JOIN {node} n ON n.vid = r.vid INNER JOIN {users} u ON u.uid = r.uid WHERE r.nid = :nid ORDER BY r.vid DESC', array(':nid' => $node->nid));
  foreach ($result as $revision) {
    $revisions[$revision->vid] = $revision;

  return $revisions;