You are here

public function RevisionsManager::loadRevisions in Node Revisions Autoclean 8

Loads revisions of a node.

Parameters

Drupal\node\Entity\Node $entity: Node to load revisions.

string $langcode: The langcode.

Return value

Drupal\node\Entity\Node[] Returns all revisions.

File

src/Services/RevisionsManager.php, line 64

Class

RevisionsManager
Class RevisionsManager.

Namespace

Drupal\node_revisions_autoclean\Services

Code

public function loadRevisions(Node $entity, $langcode = NULL) {
  $vids = $this
    ->revisionIds($entity, $langcode);
  $revisions = [];
  foreach ($vids as $vid) {
    $revisions[] = $this->entityTypeManager
      ->getStorage('node')
      ->loadRevision($vid);
  }
  return $revisions;
}