You are here

protected function MediaRevisionController::getRevisionIds in Media Revisions UI 2.0.x

Same name and namespace in other branches
  1. 8 src/Controller/MediaRevisionController.php \Drupal\media_revisions_ui\Controller\MediaRevisionController::getRevisionIds()

Gets a list of media revision IDs for a given media.

Parameters

\Drupal\media\MediaInterface $media: Media entity to search for revisions.

\Drupal\media\MediaStorage $mediaStorage: Media storage to load revisions from.

Return value

int[] Media revision IDs in descending order.

1 call to MediaRevisionController::getRevisionIds()
MediaRevisionController::revisionOverview in src/Controller/MediaRevisionController.php
Generates an overview table of older revisions of media.

File

src/Controller/MediaRevisionController.php, line 261

Class

MediaRevisionController
Provides a list of media revisions for a given media.

Namespace

Drupal\media_revisions_ui\Controller

Code

protected function getRevisionIds(MediaInterface $media, MediaStorage $mediaStorage) {
  $result = $mediaStorage
    ->getQuery()
    ->allRevisions()
    ->condition('mid', $media
    ->id())
    ->sort('vid', 'DESC')
    ->pager(50)
    ->execute();
  return array_keys($result);
}