function rest_test_entity_base_field_info

Same name and namespace in other branches
  1. 9 core/modules/rest/tests/modules/rest_test/rest_test.module \rest_test_entity_base_field_info()
  2. 8.9.x core/modules/rest/tests/modules/rest_test/rest_test.module \rest_test_entity_base_field_info()
  3. 10 core/modules/rest/tests/modules/rest_test/rest_test.module \rest_test_entity_base_field_info()

Implements hook_entity_base_field_info().

File

core/modules/rest/tests/modules/rest_test/rest_test.module, line 64

Code

function rest_test_entity_base_field_info(EntityTypeInterface $entity_type) {
    $fields = [];
    $fields['rest_test_validation'] = BaseFieldDefinition::create('string')->setLabel(t('REST test validation field'))
        ->setDescription(t('A text field with some special validations attached used for testing purposes'))
        ->addConstraint('rest_test_validation');
    return $fields;
}

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