farm-2.x-dev/modules/core/entity/tests/modules/farm_entity_contrib_test/farm_entity_contrib_test.module
modules/core/entity/tests/modules/farm_entity_contrib_test/farm_entity_contrib_test.module
<?php
/**
* @file
* Contains farm_entity_contrib_test.module.
*/
use Drupal\Core\Entity\EntityTypeInterface;
/**
* Implements hook_farm_entity_bundle_field_info().
*/
function farm_entity_contrib_test_farm_entity_bundle_field_info(EntityTypeInterface $entity_type, string $bundle) {
$fields = [];
// Add a new bundle field to test logs.
if ($entity_type->id() == 'log' && in_array($bundle, ['test'])) {
$options = [
'type' => 'string',
'label' => t('Test hook bundle field'),
];
$fields['test_contrib_hook_bundle_field'] = \Drupal::service('farm_field.factory')->bundleFieldDefinition($options);
}
return $fields;
}
