Same name and namespace in other branches
  1. 8.9.x core/modules/system/tests/modules/entity_schema_test/entity_schema_test.module \entity_schema_test_entity_bundle_field_info()
  2. 9 core/modules/system/tests/modules/entity_schema_test/entity_schema_test.module \entity_schema_test_entity_bundle_field_info()

Implements hook_entity_bundle_field_info().

File

core/modules/system/tests/modules/entity_schema_test/entity_schema_test.module, line 72
Test module for the entity API providing a bundle field.

Code

function entity_schema_test_entity_bundle_field_info(EntityTypeInterface $entity_type, $bundle) {
  if ($entity_type
    ->id() == 'entity_test_update' && $bundle == 'custom') {

    /** @var \Drupal\Core\Field\FieldStorageDefinitionInterface $custom_bundle_field_storage */
    $custom_bundle_field_storage = entity_schema_test_entity_field_storage_info($entity_type)['custom_bundle_field'];
    $definitions[$custom_bundle_field_storage
      ->getName()] = FieldDefinition::createFromFieldStorageDefinition($custom_bundle_field_storage);
    return $definitions;
  }
}