You are here

protected function NodeController::getRevisionIds in Drupal 9

Same name and namespace in other branches
  1. 8 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 301

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);
}