entity_hierarchy-8.x-2.24/tests/modules/entity_hierarchy_test_base_field/entity_hierarchy_test_base_field.module
tests/modules/entity_hierarchy_test_base_field/entity_hierarchy_test_base_field.module
<?php
/**
* @file
* Contains main module functions.
*/
use Drupal\Core\Entity\EntityTypeInterface;
use Drupal\Core\Field\BaseFieldDefinition;
/**
* Implements hook_entity_base_field_info().
*/
function entity_hierarchy_test_base_field_entity_base_field_info(EntityTypeInterface $entity_type) {
if ($entity_type->id() === 'entity_test') {
return [
'parents' => BaseFieldDefinition::create('entity_reference_hierarchy')
->setCardinality(1)->setSetting('target_type', 'entity_test')
->setLabel('Parents'),
];
}
return [];
}
