added work log NEXT: add substance log
This commit is contained in:
@@ -12,7 +12,7 @@ use Drupal\farm_entity\Plugin\Log\LogType\FarmLogType;
|
||||
* label = @Translation("Field work"),
|
||||
* )
|
||||
*/
|
||||
class FieldWork extends FarmLogType {
|
||||
class FieldWork extends WorkLog {
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
|
||||
36
src/Plugin/Log/LogType/WorkLog.php
Normal file
36
src/Plugin/Log/LogType/WorkLog.php
Normal file
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
|
||||
namespace Drupal\farm_agrikern\Plugin\Log\LogType;
|
||||
|
||||
use Drupal\farm_entity\Plugin\Log\LogType\FarmLogType;
|
||||
|
||||
/**
|
||||
* Provides the work log type.
|
||||
*/
|
||||
class WorkLog extends FarmLogType {
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function buildFieldDefinitions() {
|
||||
$fields = parent::buildFieldDefinitions();
|
||||
|
||||
$field_info = [
|
||||
'work_field' => [
|
||||
'type' => 'entity_reference',
|
||||
'label' => $this->t('Work'),
|
||||
'description' => $this->t("What type of work was done?"),
|
||||
'target_type' => 'taxonomy_term',
|
||||
'target_bundle' => 'work',
|
||||
'auto_create' => FALSE,
|
||||
'required' => TRUE,
|
||||
'multiple' => FALSE,
|
||||
],
|
||||
];
|
||||
|
||||
foreach ($field_info as $name => $info) {
|
||||
$fields[$name] = \Drupal::service('farm_field.factory')->bundleFieldDefinition($info);
|
||||
}
|
||||
|
||||
return $fields;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user