You are here

private function DibaCarousel::getEntityTypeBundles in Diba carousel slider 8

Get all entity type bundles.

2 calls to DibaCarousel::getEntityTypeBundles()
DibaCarousel::blockForm in src/Plugin/Block/DibaCarousel.php
DibaCarousel::getValidBundles in src/Plugin/Block/DibaCarousel.php
Get valid $bundles to be used in a query.

File

src/Plugin/Block/DibaCarousel.php, line 654

Class

DibaCarousel
Provides a Diba carousel Block.

Namespace

Drupal\diba_carousel\Plugin\Block

Code

private function getEntityTypeBundles($entity) {
  $options = [];
  $entity_type = $this->entityTypeManager
    ->getDefinition($entity)
    ->getBundleEntityType();
  if (!empty($entity_type)) {
    $entity_type_bundles = $this->entityTypeManager
      ->getStorage($entity_type)
      ->loadMultiple();
    if (!empty($entity_type_bundles)) {
      foreach ($entity_type_bundles as $entity_type_bundle) {
        $options[$entity_type_bundle
          ->id()] = $entity_type_bundle
          ->label();
      }
    }
  }
  return $options;
}