entity_hierarchy_test_base_field.module in Entity Reference Hierarchy 3.x
Same filename and directory in other branches
Contains main module functions.
File
tests/modules/entity_hierarchy_test_base_field/entity_hierarchy_test_base_field.moduleView source
<?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 [];
}
Functions
Name | Description |
---|---|
entity_hierarchy_test_base_field_entity_base_field_info | Implements hook_entity_base_field_info(). |