function RestTestHooks::entityBaseFieldInfo

Implements hook_entity_base_field_info().

File

core/modules/rest/tests/modules/rest_test/src/Hook/RestTestHooks.php, line 67

Class

RestTestHooks
Hook implementations for rest_test.

Namespace

Drupal\rest_test\Hook

Code

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