protected function MediaRevisionAccessCheck::countDefaultLanguageRevisions in Drupal 8
Same name and namespace in other branches
- 9 core/modules/media/src/Access/MediaRevisionAccessCheck.php \Drupal\media\Access\MediaRevisionAccessCheck::countDefaultLanguageRevisions()
Counts the number of revisions in the default language.
Parameters
\Drupal\media\MediaInterface $media: The media item for which to count the revisions.
Return value
int The number of revisions in the default language.
1 call to MediaRevisionAccessCheck::countDefaultLanguageRevisions()
- MediaRevisionAccessCheck::checkAccess in core/
modules/ media/ src/ Access/ MediaRevisionAccessCheck.php - Checks media item revision access.
File
- core/
modules/ media/ src/ Access/ MediaRevisionAccessCheck.php, line 140
Class
- MediaRevisionAccessCheck
- Provides an access checker for media item revisions.
Namespace
Drupal\media\AccessCode
protected function countDefaultLanguageRevisions(MediaInterface $media) {
$entity_type = $media
->getEntityType();
$count = $this->mediaStorage
->getQuery()
->allRevisions()
->condition($entity_type
->getKey('id'), $media
->id())
->condition($entity_type
->getKey('default_langcode'), 1)
->count()
->execute();
return $count;
}