You are here

public function Land::buildFieldDefinitions in farmOS 2.x

Overrides AssetTypeBase::buildFieldDefinitions

File

modules/asset/land/src/Plugin/Asset/AssetType/Land.php, line 20

Class

Land
Provides the land asset type.

Namespace

Drupal\farm_land\Plugin\Asset\AssetType

Code

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

  // Land type field.
  $options = [
    'type' => 'list_string',
    'label' => $this
      ->t('Land type'),
    'allowed_values_function' => 'farm_land_type_field_allowed_values',
    'required' => TRUE,
    'weight' => [
      'form' => -50,
      'view' => -50,
    ],
  ];
  $fields['land_type'] = $this->farmFieldFactory
    ->bundleFieldDefinition($options);
  return $fields;
}