function ViewsEntityTestHooks::entityBaseFieldInfo

Implements hook_entity_base_field_info().

File

core/modules/views/tests/modules/views_entity_test/src/Hook/ViewsEntityTestHooks.php, line 23

Class

ViewsEntityTestHooks
Hook implementations for views_entity_test.

Namespace

Drupal\views_entity_test\Hook

Code

public function entityBaseFieldInfo(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.