protected function Entity::getEntityBundleOptions in Entity Embed 8
Builds a list of entity type bundle options.
Configuration entity types without a view builder are filtered out while all other entity types are kept.
Return value
array An array of bundle labels, keyed by bundle name.
1 call to Entity::getEntityBundleOptions()
- Entity::buildConfigurationForm in src/
Plugin/ EmbedType/ Entity.php - Form constructor.
File
- src/
Plugin/ EmbedType/ Entity.php, line 260
Class
- Entity
- Entity embed type.
Namespace
Drupal\entity_embed\Plugin\EmbedTypeCode
protected function getEntityBundleOptions(EntityTypeInterface $entity_type) {
$bundle_options = [];
// If the entity has bundles, allow option to restrict to bundle(s).
if ($entity_type
->hasKey('bundle')) {
foreach ($this->entityTypeBundleInfo
->getBundleInfo($entity_type
->id()) as $bundle_id => $bundle_info) {
$bundle_options[$bundle_id] = $bundle_info['label'];
}
natsort($bundle_options);
}
return $bundle_options;
}