LabTest.php in farmOS 2.x
File
modules/log/lab_test/src/Plugin/Log/LogType/LabTest.php
View source
<?php
namespace Drupal\farm_lab_test\Plugin\Log\LogType;
use Drupal\farm_entity\Plugin\Log\LogType\FarmLogType;
class LabTest extends FarmLogType {
public function buildFieldDefinitions() {
$fields = parent::buildFieldDefinitions();
$options = [
'type' => 'string',
'label' => $this
->t('Laboratory'),
'description' => $this
->t('What laboratory performed this test?'),
'weight' => [
'form' => -40,
'view' => -40,
],
];
$fields['lab'] = $this->farmFieldFactory
->bundleFieldDefinition($options);
$options = [
'type' => 'list_string',
'label' => $this
->t('Test type'),
'allowed_values_function' => 'farm_lab_test_type_field_allowed_values',
'weight' => [
'form' => -50,
'view' => -50,
],
];
$fields['lab_test_type'] = $this->farmFieldFactory
->bundleFieldDefinition($options);
return $fields;
}
}
Classes
Name |
Description |
LabTest |
Provides the lab test log type. |