You are here

function views_entity_test_entity_base_field_info in Drupal 8

Same name and namespace in other branches
  1. 9 core/modules/views/tests/modules/views_entity_test/views_entity_test.module \views_entity_test_entity_base_field_info()

Implements hook_entity_bundle_field_info().

File

core/modules/views/tests/modules/views_entity_test/views_entity_test.module, line 18
Contains main module functionality.

Code

function views_entity_test_entity_base_field_info(EntityTypeInterface $entity_type) {
  if ($entity_type
    ->id() == 'entity_test') {
    $definitions['test_text_access'] = BaseFieldDefinition::create('string')
      ->setLabel(t('Test access'))
      ->setTranslatable(FALSE)
      ->setSetting('max_length', 64)
      ->setDisplayOptions('form', [
      'type' => 'string_textfield',
      'weight' => 10,
    ]);
    return $definitions;
  }
}