public function ContentHubSubscriberController::getSupportedEntityTypesAndBundles in Acquia Content Hub 8
Obtains a list of supported entity types and bundles by this site.
This also includes the 'bundle' key field. If the bundle key is empty this means that this entity does not have any bundle information.
Return value
array An array of entity_types and bundles keyed by entity_type.
1 call to ContentHubSubscriberController::getSupportedEntityTypesAndBundles()
- ContentHubSubscriberController::loadDiscovery in acquia_contenthub_subscriber/
src/ Controller/ ContentHubSubscriberController.php - Loads the content hub discovery page from an ember app.
File
- acquia_contenthub_subscriber/
src/ Controller/ ContentHubSubscriberController.php, line 130
Class
- ContentHubSubscriberController
- Controller for Content Hub Discovery page.
Namespace
Drupal\acquia_contenthub_subscriber\ControllerCode
public function getSupportedEntityTypesAndBundles() {
$entity_types = $this->entityManager
->getAllowedEntityTypes();
$entity_types_and_bundles = [];
foreach ($entity_types as $entity_type => $bundles) {
if ($entity_type === 'taxonomy_term') {
$bundle_key = 'vocabulary';
}
else {
$bundle_key = $this->entityTypeManager
->getDefinition($entity_type)
->getKey('bundle');
}
$entity_types_and_bundles[$entity_type] = [
'bundle_key' => $bundle_key,
'bundles' => array_keys($bundles),
];
}
return $entity_types_and_bundles;
}