Contains hook implementations for the jsonapi_test_reference_types module.

File

core/modules/jsonapi/tests/modules/jsonapi_test_reference_types/jsonapi_test_reference_types.module
View source
<?php

/**
 * @file
 * Contains hook implementations for the jsonapi_test_reference_types module.
 */
use Drupal\Core\Entity\EntityTypeInterface;
use Drupal\Core\Field\BaseFieldDefinition;

/**
 * Implements hook_entity_base_field_info().
 */
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;
  }
}

Functions