Material.php in farmOS 2.x
File
modules/quantity/material/src/Plugin/Quantity/QuantityType/Material.php
View source
<?php
namespace Drupal\farm_quantity_material\Plugin\Quantity\QuantityType;
use Drupal\farm_entity\Plugin\Quantity\QuantityType\FarmQuantityType;
class Material extends FarmQuantityType {
public function buildFieldDefinitions() {
$fields = parent::buildFieldDefinitions();
$options = [
'type' => 'entity_reference',
'label' => $this
->t('Material type'),
'description' => $this
->t('What type of materials are being applied?'),
'target_type' => 'taxonomy_term',
'target_bundle' => 'material_type',
'auto_create' => TRUE,
'weight' => [
'form' => -50,
'view' => -50,
],
];
$fields['material_type'] = $this->farmFieldFactory
->bundleFieldDefinition($options);
return $fields;
}
}
Classes
Name |
Description |
Material |
Provides the material quantity type. |