FarmPlanType.php in farmOS 2.x
File
modules/core/entity/src/Plugin/Plan/PlanType/FarmPlanType.php
View source
<?php
namespace Drupal\farm_entity\Plugin\Plan\PlanType;
use Drupal\Core\StringTranslation\StringTranslationTrait;
class FarmPlanType extends PlanTypeBase {
use StringTranslationTrait;
public function buildFieldDefinitions() {
$fields = [];
$options = [
'type' => 'entity_reference',
'label' => $this
->t('Assets'),
'target_type' => 'asset',
'multiple' => TRUE,
'hidden' => TRUE,
];
$fields['asset'] = $this->farmFieldFactory
->bundleFieldDefinition($options);
$options = [
'type' => 'entity_reference',
'label' => $this
->t('Logs'),
'target_type' => 'log',
'multiple' => TRUE,
'hidden' => TRUE,
];
$fields['log'] = $this->farmFieldFactory
->bundleFieldDefinition($options);
return $fields;
}
}