You are here

public function PurchasableEntityTypeRepository::getPurchasableEntityTypes in Commerce Core 8.2

Gets the full list of purchasable entity types.

Return value

\Drupal\Core\Entity\EntityTypeInterface[] An array of purchasable entity type definitions keyed by entity type ID.

Overrides PurchasableEntityTypeRepositoryInterface::getPurchasableEntityTypes

2 calls to PurchasableEntityTypeRepository::getPurchasableEntityTypes()
PurchasableEntityTypeRepository::getDefaultPurchasableEntityType in src/PurchasableEntityTypeRepository.php
Returns a sensible default purchasable entity type.
PurchasableEntityTypeRepository::getPurchasableEntityTypeLabels in src/PurchasableEntityTypeRepository.php
Builds a list of entity type labels suitable for a Form API options list.

File

src/PurchasableEntityTypeRepository.php, line 30

Class

PurchasableEntityTypeRepository

Namespace

Drupal\commerce

Code

public function getPurchasableEntityTypes() {
  return array_filter($this->entityTypeManager
    ->getDefinitions(), static function (EntityTypeInterface $entity_type) {
    return $entity_type
      ->entityClassImplements(PurchasableEntityInterface::class);
  });
}