function ViewsEntityTestHooks::entityBaseFieldInfo

Implements hook_entity_base_field_info().

Attributes

#[Hook('entity_base_field_info')]

File

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

Class

ViewsEntityTestHooks
Hook implementations for views_entity_test.

Namespace

Drupal\views_entity_test\Hook

Code

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

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