function farm_group_asset_base_fields in farmOS 2.x
Define asset group base fields.
1 call to farm_group_asset_base_fields()
- farm_group_entity_base_field_info in modules/
asset/ group/ farm_group.module - Implements hook_entity_base_field_info().
File
- modules/
asset/ group/ farm_group.base_fields.inc, line 13 - Code for creating farmOS group membership base field definitions.
Code
function farm_group_asset_base_fields() {
$fields = [];
// Group membership field.
// This is computed based on an asset's group assignment logs.
$options = [
'type' => 'entity_reference',
'label' => t('Group membership'),
'target_type' => 'asset',
'target_bundle' => 'group',
'multiple' => TRUE,
'computed' => AssetGroupItemList::class,
'hidden' => 'form',
'weight' => [
'view' => 94,
],
];
$fields['group'] = \Drupal::service('farm_field.factory')
->baseFieldDefinition($options);
return $fields;
}