public function SmartQueue::getBundleOptions in Entityqueue 8
Gets the list of bundle options for an entity type.
Parameters
string $entity_type_id: The entity type ID.
Return value
array An array of bundle labels, keyed by bundle name.
1 call to SmartQueue::getBundleOptions()
- SmartQueue::buildConfigurationForm in modules/
entityqueue_smartqueue/ src/ Plugin/ EntityQueueHandler/ SmartQueue.php - Form constructor.
File
- modules/
entityqueue_smartqueue/ src/ Plugin/ EntityQueueHandler/ SmartQueue.php, line 144
Class
- SmartQueue
- Plugin annotation @EntityQueueHandler( id = "smartqueue", title = @Translation("Smart queue"), description = @Translation("Provides automated subqueues for each entity of a given type."), )
Namespace
Drupal\entityqueue_smartqueue\Plugin\EntityQueueHandlerCode
public function getBundleOptions($entity_type_id) {
$bundle_options = [];
if (!$entity_type_id) {
return $bundle_options;
}
$entity_type = $this->entityTypeManager
->getDefinition($entity_type_id);
if ($entity_type
->hasKey('bundle')) {
foreach ($this->entityTypeBundleInfo
->getBundleInfo($entity_type_id) as $bundle_name => $bundle_info) {
$bundle_options[$bundle_name] = $bundle_info['label'];
}
natsort($bundle_options);
}
return $bundle_options;
}