function jsonapi_test_reference_types_entity_base_field_info

Implements hook_entity_base_field_info().

File

core/modules/jsonapi/tests/modules/jsonapi_test_reference_types/jsonapi_test_reference_types.module, line 14

Code

function jsonapi_test_reference_types_entity_base_field_info(EntityTypeInterface $entity_type) {
  // Add a field of the deprecated reference type to nodes.
  if ($entity_type->id() === 'node') {
    $fields = [];
    $fields['deprecated_reference'] = BaseFieldDefinition::create('jsonapi_test_deprecated_reference')->setLabel(t('Reference'))
      ->setDescription(t('Deprecated reference field.'));
    return $fields;
  }
}

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