You are here

public function Structure::buildFieldDefinitions in farmOS 2.x

Overrides AssetTypeBase::buildFieldDefinitions

File

modules/asset/structure/src/Plugin/Asset/AssetType/Structure.php, line 20

Class

Structure
Provides the structure asset type.

Namespace

Drupal\farm_structure\Plugin\Asset\AssetType

Code

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

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