You are here

public function BynderService::getBynderMediaTypes in Bynder 4.0.x

Same name and namespace in other branches
  1. 8.3 src/BynderService.php \Drupal\bynder\BynderService::getBynderMediaTypes()
  2. 8.2 src/BynderService.php \Drupal\bynder\BynderService::getBynderMediaTypes()

Returns the Bynder media types.

Return value

\Drupal\media\MediaTypeInterface[] A list of Bynder media types.

Overrides BynderServiceInterface::getBynderMediaTypes

2 calls to BynderService::getBynderMediaTypes()
BynderService::getTotalCountOfMediaEntities in src/BynderService.php
Returns the total number of Bynder media entities.
BynderService::updateMetadataLastMediaEntities in src/BynderService.php
Updates metadata of the next N media entities starting at the minimum ID.

File

src/BynderService.php, line 124

Class

BynderService
Bynder service.

Namespace

Drupal\bynder

Code

public function getBynderMediaTypes() {
  $bynder_media_types = [];

  /** @var \Drupal\media\MediaTypeInterface $media_type */
  foreach ($this->entityTypeManager
    ->getStorage('media_type')
    ->loadMultiple() as $media_type_id => $media_type) {
    if ($media_type
      ->getSource() instanceof Bynder) {
      $bynder_media_types[$media_type_id] = $media_type;
    }
  }
  return $bynder_media_types;
}