You are here

protected function NodeController::getRevisionIds in Drupal 8

Same name and namespace in other branches
  1. 9 core/modules/node/src/Controller/NodeController.php \Drupal\node\Controller\NodeController::getRevisionIds()
  2. 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 326

Class

NodeController
Returns responses for Node routes.

Namespace

Drupal\node\Controller

Code

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