function commerce_recurring_commerce_entity_trait_info_alter in Commerce Recurring Framework 8
Implements hook_commerce_entity_trait_info_alter().
File
- ./
commerce_recurring.module, line 16 - Provides recurring billing for Drupal Commerce.
Code
function commerce_recurring_commerce_entity_trait_info_alter(array &$definitions) {
// Expose the purchasable entity trait for every purchasable entity type.
$entity_types = \Drupal::entityTypeManager()
->getDefinitions();
$entity_types = array_filter($entity_types, function (EntityTypeInterface $entity_type) {
return $entity_type
->entityClassImplements(PurchasableEntityInterface::class);
});
$entity_type_ids = array_keys($entity_types);
$definitions['purchasable_entity_subscription']['entity_types'] = $entity_type_ids;
}