function ResourceTypeRepository::getAllBundlesForEntityType

Gets all bundle IDs for a given entity type.

Parameters

string $entity_type_id: The entity type for which to get bundles.

Return value

string[] The bundle IDs.

1 call to ResourceTypeRepository::getAllBundlesForEntityType()
ResourceTypeRepository::getRelatableResourceTypesFromFieldDefinition in core/modules/jsonapi/src/ResourceType/ResourceTypeRepository.php
Get relatable resource types from a field definition.

File

core/modules/jsonapi/src/ResourceType/ResourceTypeRepository.php, line 505

Class

ResourceTypeRepository
Provides a repository of all JSON:API resource types.

Namespace

Drupal\jsonapi\ResourceType

Code

protected function getAllBundlesForEntityType($entity_type_id) {
  // Ensure all keys are strings because numeric values are allowed as bundle
  // names and "array_keys()" casts "42" to 42.
  return array_map('strval', array_keys($this->entityTypeBundleInfo
    ->getBundleInfo($entity_type_id)));
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.