You are here

function entity_entity_bundle_field_info in Entity API 8

Implements hook_entity_bundle_field_info().

File

./entity.module, line 118
Provides expanded entity APIs.

Code

function entity_entity_bundle_field_info(EntityTypeInterface $entity_type, $bundle) {
  if ($entity_type
    ->hasHandlerClass('bundle_plugin')) {

    /** @var \Drupal\entity\BundlePlugin\BundlePluginHandler $bundle_handler */
    $bundle_handler = \Drupal::entityTypeManager()
      ->getHandler($entity_type
      ->id(), 'bundle_plugin');
    return $bundle_handler
      ->getFieldDefinitions($bundle);
  }
}