function views_entity_test_entity_base_field_info

Same name in other branches
  1. 9 core/modules/views/tests/modules/views_entity_test/views_entity_test.module \views_entity_test_entity_base_field_info()
  2. 8.9.x core/modules/views/tests/modules/views_entity_test/views_entity_test.module \views_entity_test_entity_base_field_info()
  3. 10 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 20

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;
    }
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.