mirror of
https://github.com/farmOS/farmOS.git
synced 2024-02-23 11:37:38 +01:00
Move ID Tag base field to farm_id_tag.
This commit is contained in:
parent
e9e523c095
commit
20ceb84193
|
@ -25,16 +25,6 @@ function farm_entity_fields_asset_base_fields() {
|
|||
'view' => 90,
|
||||
],
|
||||
],
|
||||
'id_tag' => [
|
||||
'type' => 'id_tag',
|
||||
'label' => t('ID tags'),
|
||||
'description' => t('List any identification tags that this asset has. Use the fields below to describe the type, location, and ID of each.'),
|
||||
'multiple' => TRUE,
|
||||
'weight' => [
|
||||
'form' => 50,
|
||||
'view' => 50,
|
||||
],
|
||||
],
|
||||
'image' => [
|
||||
'type' => 'image',
|
||||
'label' => t('Images'),
|
||||
|
|
|
@ -36,6 +36,7 @@ class FarmEntityFieldTest extends KernelTestBase {
|
|||
'farm_entity_fields',
|
||||
'farm_entity_test',
|
||||
'farm_flag',
|
||||
'farm_id_tag',
|
||||
'farm_location',
|
||||
'farm_log',
|
||||
'farm_owner',
|
||||
|
|
|
@ -5,3 +5,4 @@ package: farmOS
|
|||
core_version_requirement: ^9
|
||||
dependencies:
|
||||
- farm:asset
|
||||
- farm:farm_field
|
||||
|
|
|
@ -5,6 +5,32 @@
|
|||
* ID tag module.
|
||||
*/
|
||||
|
||||
use Drupal\Core\Entity\EntityTypeInterface;
|
||||
|
||||
/**
|
||||
* Implements hook_entity_base_field_info().
|
||||
*/
|
||||
function farm_id_tag_entity_base_field_info(EntityTypeInterface $entity_type) {
|
||||
$fields = [];
|
||||
|
||||
// Add ID tag field to assets.
|
||||
if ($entity_type->id() == 'asset') {
|
||||
$field_info = [
|
||||
'type' => 'id_tag',
|
||||
'label' => t('ID tags'),
|
||||
'description' => t('List any identification tags that this asset has. Use the fields below to describe the type, location, and ID of each.'),
|
||||
'multiple' => TRUE,
|
||||
'weight' => [
|
||||
'form' => 50,
|
||||
'view' => 50,
|
||||
],
|
||||
];
|
||||
$fields['id_tag'] = \Drupal::service('farm_field.factory')->baseFieldDefinition($field_info);
|
||||
}
|
||||
|
||||
return $fields;
|
||||
}
|
||||
|
||||
/**
|
||||
* Allowed values callback function for the ID tag type field.
|
||||
*
|
||||
|
|
Loading…
Reference in a new issue