public function BynderService::getTotalCountOfMediaEntities in Bynder 8.2
Same name and namespace in other branches
- 8.3 src/BynderService.php \Drupal\bynder\BynderService::getTotalCountOfMediaEntities()
- 4.0.x src/BynderService.php \Drupal\bynder\BynderService::getTotalCountOfMediaEntities()
Returns the total number of Bynder media entities.
Return value
int A total number of Bynder media entities.
Overrides BynderServiceInterface::getTotalCountOfMediaEntities
File
- src/
BynderService.php, line 128
Class
- BynderService
- Bynder service.
Namespace
Drupal\bynderCode
public function getTotalCountOfMediaEntities() {
$bynder_media_types = $this
->getBynderMediaTypes();
if (empty($bynder_media_types)) {
return 0;
}
$count = $this->mediaStorage
->getQuery()
->accessCheck(FALSE)
->condition($this->mediaStorage
->getEntityType()
->getKey('bundle'), array_keys($bynder_media_types), 'IN')
->count()
->execute();
return (int) $count;
}