NodeController::getRevisionIds

protected NodeController::getRevisionIds(NodeInterface $node, NodeStorageInterface $node_storage)

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).

File

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

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);
}
doc_Drupal
2016-10-29 09:30:38
Comments
Leave a Comment

Please login to continue.