function RestTestHooks::entityBaseFieldInfo

Implements hook_entity_base_field_info().

File

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

Class

RestTestHooks
Hook implementations for rest_test.

Namespace

Drupal\rest_test\Hook

Code

public function entityBaseFieldInfo(EntityTypeInterface $entity_type) : array {
    $fields = [];
    $fields['rest_test_validation'] = BaseFieldDefinition::create('string')->setLabel('REST test validation field')
        ->setDescription('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.