You are here

function farm_id_tag_entity_base_field_info in farmOS 2.x

Implements hook_entity_base_field_info().

File

modules/core/id_tag/farm_id_tag.module, line 13
ID tag module.

Code

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;
}