Structure.php in farmOS 2.x
File
modules/asset/structure/src/Plugin/Asset/AssetType/Structure.php
View source
<?php
namespace Drupal\farm_structure\Plugin\Asset\AssetType;
use Drupal\farm_entity\Plugin\Asset\AssetType\FarmAssetType;
class Structure extends FarmAssetType {
public function buildFieldDefinitions() {
$fields = [];
$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;
}
}