You are here

farm_location_test.module in farmOS 2.x

File

modules/core/location/tests/modules/farm_location_test/farm_location_test.module
View source
<?php

/**
 * @file
 * Contains farm_location_test.module.
 */
use Drupal\Core\Entity\EntityTypeInterface;

/**
 * Implements hook_entity_base_field_info().
 */
function farm_location_test_entity_base_field_info(EntityTypeInterface $entity_type) {
  $fields = [];
  if ($entity_type
    ->id() == 'log') {
    $options = [
      'type' => 'entity_reference',
      'label' => t('Asset'),
      'target_type' => 'asset',
      'multiple' => TRUE,
    ];
    $fields['asset'] = \Drupal::service('farm_field.factory')
      ->baseFieldDefinition($options);
  }
  return $fields;
}