You are here

public function FarmPlanType::buildFieldDefinitions in farmOS 2.x

Overrides PlanTypeBase::buildFieldDefinitions

1 call to FarmPlanType::buildFieldDefinitions()
Second::buildFieldDefinitions in modules/core/entity/tests/modules/farm_entity_bundle_fields_test/src/Plugin/Plan/PlanType/Second.php
1 method overrides FarmPlanType::buildFieldDefinitions()
Second::buildFieldDefinitions in modules/core/entity/tests/modules/farm_entity_bundle_fields_test/src/Plugin/Plan/PlanType/Second.php

File

modules/core/entity/src/Plugin/Plan/PlanType/FarmPlanType.php, line 17

Class

FarmPlanType
Provides a farmOS plan type base class.

Namespace

Drupal\farm_entity\Plugin\Plan\PlanType

Code

public function buildFieldDefinitions() {
  $fields = [];

  // Assets in the plan.
  $options = [
    'type' => 'entity_reference',
    'label' => $this
      ->t('Assets'),
    'target_type' => 'asset',
    'multiple' => TRUE,
    'hidden' => TRUE,
  ];
  $fields['asset'] = $this->farmFieldFactory
    ->bundleFieldDefinition($options);

  // Logs in the plan.
  $options = [
    'type' => 'entity_reference',
    'label' => $this
      ->t('Logs'),
    'target_type' => 'log',
    'multiple' => TRUE,
    'hidden' => TRUE,
  ];
  $fields['log'] = $this->farmFieldFactory
    ->bundleFieldDefinition($options);
  return $fields;
}