function commerce_pricelist_entity_bundle_info in Commerce Pricelist 8.2
Implements hook_entity_bundle_info().
File
- ./
commerce_pricelist.module, line 35 - Allows defining prices for specific stores, customers, quantities.
Code
function commerce_pricelist_entity_bundle_info() {
$entity_types = \Drupal::entityTypeManager()
->getDefinitions();
$purchasable_entity_types = array_filter($entity_types, function (EntityTypeInterface $entity_type) {
return $entity_type
->entityClassImplements(PurchasableEntityInterface::class);
});
$bundles = [];
foreach ($purchasable_entity_types as $entity_type) {
$bundles['commerce_pricelist'][$entity_type
->id()] = [
'label' => $entity_type
->getLabel(),
'description' => t('Create a price list for @plural_label', [
'@plural_label' => $entity_type
->getPluralLabel(),
]),
'translatable' => FALSE,
'provider' => 'commerce_pricelist',
];
$bundles['commerce_pricelist_item'][$entity_type
->id()] = [
'label' => $entity_type
->getLabel(),
'translatable' => FALSE,
'provider' => 'commerce_pricelist',
];
}
return $bundles;
}