You are here

protected function ExtraFieldDisplayManager::allEntityBundles in Extra Field 8

Returns the bundles that are defined for an entity type.

Parameters

string $entityType: The entity type to get the bundles for.

Return value

string[] Array of bundle names.

1 call to ExtraFieldDisplayManager::allEntityBundles()
ExtraFieldDisplayManager::supportedEntityBundles in src/Plugin/ExtraFieldDisplayManager.php
Returns entity-bundle combinations this plugin supports.

File

src/Plugin/ExtraFieldDisplayManager.php, line 190

Class

ExtraFieldDisplayManager
Manages Extra Field plugins.

Namespace

Drupal\extra_field\Plugin

Code

protected function allEntityBundles($entityType) {
  if (!isset($this->entityBundles[$entityType])) {
    $bundleType = $this->entityTypeManager
      ->getDefinition($entityType)
      ->getBundleEntityType();
    if ($bundleType) {
      $bundles = $this->entityTypeManager
        ->getStorage($bundleType)
        ->getQuery()
        ->execute();
    }
    else {
      $bundles = [
        $entityType => $entityType,
      ];
    }
    $this->entityBundles[$entityType] = $bundles;
  }
  return $this->entityBundles[$entityType];
}