You are here

function entity_schema_test_entity_field_storage_info in Drupal 8

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

Implements hook_entity_field_storage_info().

File

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

Code

function entity_schema_test_entity_field_storage_info(EntityTypeInterface $entity_type) {
  if ($entity_type
    ->id() == 'entity_test_update') {
    $definitions['custom_bundle_field'] = FieldStorageDefinition::create('string')
      ->setName('custom_bundle_field')
      ->setLabel(t('A custom bundle field'))
      ->setRevisionable(TRUE)
      ->setTargetEntityTypeId($entity_type
      ->id());
    return $definitions;
  }
}