function NodeController::getRevisionIds

Same name in other branches
  1. 9 core/modules/node/src/Controller/NodeController.php \Drupal\node\Controller\NodeController::getRevisionIds()
  2. 8.9.x core/modules/node/src/Controller/NodeController.php \Drupal\node\Controller\NodeController::getRevisionIds()
  3. 10 core/modules/node/src/Controller/NodeController.php \Drupal\node\Controller\NodeController::getRevisionIds()

Gets a list of node revision IDs for a specific node.

Parameters

\Drupal\node\NodeInterface $node: The node entity.

\Drupal\node\NodeStorageInterface $node_storage: The node storage handler.

Return value

int[] Node revision IDs (in descending order).

1 call to NodeController::getRevisionIds()
NodeController::revisionOverview in core/modules/node/src/Controller/NodeController.php
Generates an overview table of older revisions of a node.

File

core/modules/node/src/Controller/NodeController.php, line 288

Class

NodeController
Returns responses for Node routes.

Namespace

Drupal\node\Controller

Code

protected function getRevisionIds(NodeInterface $node, NodeStorageInterface $node_storage) {
    $result = $node_storage->getQuery()
        ->accessCheck(TRUE)
        ->allRevisions()
        ->condition($node->getEntityType()
        ->getKey('id'), $node->id())
        ->sort($node->getEntityType()
        ->getKey('revision'), 'DESC')
        ->pager(50)
        ->execute();
    return array_keys($result);
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.