mirror of
https://github.com/farmOS/farmOS.git
synced 2024-02-23 11:37:38 +01:00
Convert all log config fields to bundle fields.
This commit is contained in:
parent
273daf9697
commit
84dc39d9e2
|
@ -1,20 +0,0 @@
|
|||
langcode: en
|
||||
status: true
|
||||
dependencies:
|
||||
module:
|
||||
- log
|
||||
id: log.invoice_number
|
||||
field_name: invoice_number
|
||||
entity_type: log
|
||||
type: string
|
||||
settings:
|
||||
max_length: 255
|
||||
is_ascii: false
|
||||
case_sensitive: false
|
||||
module: core
|
||||
locked: false
|
||||
cardinality: 1
|
||||
translatable: true
|
||||
indexes: { }
|
||||
persist_with_no_fields: false
|
||||
custom_storage: false
|
|
@ -1,20 +0,0 @@
|
|||
langcode: en
|
||||
status: true
|
||||
dependencies:
|
||||
module:
|
||||
- log
|
||||
id: log.lab
|
||||
field_name: lab
|
||||
entity_type: log
|
||||
type: string
|
||||
settings:
|
||||
max_length: 255
|
||||
is_ascii: false
|
||||
case_sensitive: false
|
||||
module: core
|
||||
locked: false
|
||||
cardinality: 1
|
||||
translatable: true
|
||||
indexes: { }
|
||||
persist_with_no_fields: false
|
||||
custom_storage: false
|
|
@ -1,20 +0,0 @@
|
|||
langcode: en
|
||||
status: true
|
||||
dependencies:
|
||||
module:
|
||||
- log
|
||||
id: log.lot_number
|
||||
field_name: lot_number
|
||||
entity_type: log
|
||||
type: string
|
||||
settings:
|
||||
max_length: 255
|
||||
is_ascii: false
|
||||
case_sensitive: false
|
||||
module: core
|
||||
locked: false
|
||||
cardinality: 1
|
||||
translatable: true
|
||||
indexes: { }
|
||||
persist_with_no_fields: false
|
||||
custom_storage: false
|
|
@ -1,20 +0,0 @@
|
|||
langcode: en
|
||||
status: true
|
||||
dependencies:
|
||||
module:
|
||||
- log
|
||||
id: log.method
|
||||
field_name: method
|
||||
entity_type: log
|
||||
type: string
|
||||
settings:
|
||||
max_length: 255
|
||||
is_ascii: false
|
||||
case_sensitive: false
|
||||
module: core
|
||||
locked: false
|
||||
cardinality: 1
|
||||
translatable: true
|
||||
indexes: { }
|
||||
persist_with_no_fields: false
|
||||
custom_storage: false
|
|
@ -1,17 +0,0 @@
|
|||
langcode: en
|
||||
status: true
|
||||
dependencies:
|
||||
module:
|
||||
- log
|
||||
id: log.purchase_date
|
||||
field_name: purchase_date
|
||||
entity_type: log
|
||||
type: timestamp
|
||||
settings: { }
|
||||
module: core
|
||||
locked: false
|
||||
cardinality: 1
|
||||
translatable: true
|
||||
indexes: { }
|
||||
persist_with_no_fields: false
|
||||
custom_storage: false
|
|
@ -1,20 +0,0 @@
|
|||
langcode: en
|
||||
status: true
|
||||
dependencies:
|
||||
module:
|
||||
- log
|
||||
id: log.source
|
||||
field_name: source
|
||||
entity_type: log
|
||||
type: string
|
||||
settings:
|
||||
max_length: 255
|
||||
is_ascii: false
|
||||
case_sensitive: false
|
||||
module: core
|
||||
locked: false
|
||||
cardinality: 1
|
||||
translatable: true
|
||||
indexes: { }
|
||||
persist_with_no_fields: false
|
||||
custom_storage: false
|
|
@ -1,20 +0,0 @@
|
|||
langcode: en
|
||||
status: true
|
||||
dependencies:
|
||||
module:
|
||||
- log
|
||||
id: log.vet
|
||||
field_name: vet
|
||||
entity_type: log
|
||||
type: string
|
||||
settings:
|
||||
max_length: 255
|
||||
is_ascii: false
|
||||
case_sensitive: false
|
||||
module: core
|
||||
locked: false
|
||||
cardinality: 1
|
||||
translatable: true
|
||||
indexes: { }
|
||||
persist_with_no_fields: false
|
||||
custom_storage: false
|
|
@ -6,5 +6,5 @@ core_version_requirement: ^9
|
|||
dependencies:
|
||||
- farm:farm_field
|
||||
- farm:farm_flag
|
||||
- log:log
|
||||
- farm:farm_log
|
||||
- token:token
|
||||
|
|
17
modules/log/activity/src/Plugin/Log/LogType/Activity.php
Normal file
17
modules/log/activity/src/Plugin/Log/LogType/Activity.php
Normal file
|
@ -0,0 +1,17 @@
|
|||
<?php
|
||||
|
||||
namespace Drupal\farm_activity\Plugin\Log\LogType;
|
||||
|
||||
use Drupal\farm_log\Plugin\Log\LogType\LogTypeBase;
|
||||
|
||||
/**
|
||||
* Provides the activity log type.
|
||||
*
|
||||
* @LogType(
|
||||
* id = "activity",
|
||||
* label = @Translation("Activity"),
|
||||
* )
|
||||
*/
|
||||
class Activity extends LogTypeBase {
|
||||
|
||||
}
|
|
@ -1,18 +0,0 @@
|
|||
langcode: en
|
||||
status: true
|
||||
dependencies:
|
||||
config:
|
||||
- field.storage.log.lot_number
|
||||
- log.type.harvest
|
||||
id: log.harvest.lot_number
|
||||
field_name: lot_number
|
||||
entity_type: log
|
||||
bundle: harvest
|
||||
label: 'Lot number'
|
||||
description: 'If this harvest is part of a batch or lot, enter the lot number here.'
|
||||
required: false
|
||||
translatable: false
|
||||
default_value: { }
|
||||
default_value_callback: ''
|
||||
settings: { }
|
||||
field_type: string
|
|
@ -6,5 +6,5 @@ core_version_requirement: ^9
|
|||
dependencies:
|
||||
- farm:farm_field
|
||||
- farm:farm_flag
|
||||
- log:log
|
||||
- farm:farm_log
|
||||
- token:token
|
||||
|
|
38
modules/log/harvest/src/Plugin/Log/LogType/Harvest.php
Normal file
38
modules/log/harvest/src/Plugin/Log/LogType/Harvest.php
Normal file
|
@ -0,0 +1,38 @@
|
|||
<?php
|
||||
|
||||
namespace Drupal\farm_harvest\Plugin\Log\LogType;
|
||||
|
||||
use Drupal\farm_log\Plugin\Log\LogType\LogTypeBase;
|
||||
|
||||
/**
|
||||
* Provides the harvest log type.
|
||||
*
|
||||
* @LogType(
|
||||
* id = "harvest",
|
||||
* label = @Translation("Harvest"),
|
||||
* )
|
||||
*/
|
||||
class Harvest extends LogTypeBase {
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function buildFieldDefinitions() {
|
||||
$fields = parent::buildFieldDefinitions();
|
||||
|
||||
// Lot number.
|
||||
$options = [
|
||||
'type' => 'string',
|
||||
'label' => 'Lot number',
|
||||
'description' => 'If this harvest is part of a batch or lot, enter the lot number here.',
|
||||
'weight' => [
|
||||
'form' => 20,
|
||||
'view' => 20,
|
||||
],
|
||||
];
|
||||
$fields['lot_number'] = \Drupal::service('farm_field.factory')->bundleFieldDefinition($options);
|
||||
|
||||
return $fields;
|
||||
}
|
||||
|
||||
}
|
|
@ -1,18 +0,0 @@
|
|||
langcode: en
|
||||
status: true
|
||||
dependencies:
|
||||
config:
|
||||
- field.storage.log.lot_number
|
||||
- log.type.input
|
||||
id: log.input.lot_number
|
||||
field_name: lot_number
|
||||
entity_type: log
|
||||
bundle: input
|
||||
label: 'Lot number'
|
||||
description: 'If the manufacturer assigned this input a lot number, enter it here.'
|
||||
required: false
|
||||
translatable: false
|
||||
default_value: { }
|
||||
default_value_callback: ''
|
||||
settings: { }
|
||||
field_type: string
|
|
@ -1,28 +0,0 @@
|
|||
langcode: en
|
||||
status: true
|
||||
dependencies:
|
||||
config:
|
||||
- field.storage.log.material
|
||||
- log.type.input
|
||||
- taxonomy.vocabulary.material
|
||||
id: log.input.material
|
||||
field_name: material
|
||||
entity_type: log
|
||||
bundle: input
|
||||
label: Material
|
||||
description: 'What materials are being applied?'
|
||||
required: false
|
||||
translatable: false
|
||||
default_value: { }
|
||||
default_value_callback: ''
|
||||
settings:
|
||||
handler: 'default:taxonomy_term'
|
||||
handler_settings:
|
||||
target_bundles:
|
||||
material: material
|
||||
sort:
|
||||
field: name
|
||||
direction: asc
|
||||
auto_create: false
|
||||
auto_create_bundle: ''
|
||||
field_type: entity_reference
|
|
@ -1,18 +0,0 @@
|
|||
langcode: en
|
||||
status: true
|
||||
dependencies:
|
||||
config:
|
||||
- field.storage.log.method
|
||||
- log.type.input
|
||||
id: log.input.method
|
||||
field_name: method
|
||||
entity_type: log
|
||||
bundle: input
|
||||
label: Method
|
||||
description: 'How was this input applied?'
|
||||
required: false
|
||||
translatable: false
|
||||
default_value: { }
|
||||
default_value_callback: ''
|
||||
settings: { }
|
||||
field_type: string
|
|
@ -1,18 +0,0 @@
|
|||
langcode: en
|
||||
status: true
|
||||
dependencies:
|
||||
config:
|
||||
- field.storage.log.purchase_date
|
||||
- log.type.input
|
||||
id: log.input.purchase_date
|
||||
field_name: purchase_date
|
||||
entity_type: log
|
||||
bundle: input
|
||||
label: 'Purchase date'
|
||||
description: 'When was this input purchased (if applicable)?'
|
||||
required: false
|
||||
translatable: false
|
||||
default_value: { }
|
||||
default_value_callback: ''
|
||||
settings: { }
|
||||
field_type: timestamp
|
|
@ -1,18 +0,0 @@
|
|||
langcode: en
|
||||
status: true
|
||||
dependencies:
|
||||
config:
|
||||
- field.storage.log.source
|
||||
- log.type.input
|
||||
id: log.input.source
|
||||
field_name: source
|
||||
entity_type: log
|
||||
bundle: input
|
||||
label: Source
|
||||
description: 'Where was this input obtained? Who manufactured it?'
|
||||
required: false
|
||||
translatable: false
|
||||
default_value: { }
|
||||
default_value_callback: ''
|
||||
settings: { }
|
||||
field_type: string
|
|
@ -1,19 +0,0 @@
|
|||
langcode: en
|
||||
status: true
|
||||
dependencies:
|
||||
module:
|
||||
- log
|
||||
- taxonomy
|
||||
id: log.material
|
||||
field_name: material
|
||||
entity_type: log
|
||||
type: entity_reference
|
||||
settings:
|
||||
target_type: taxonomy_term
|
||||
module: core
|
||||
locked: false
|
||||
cardinality: -1
|
||||
translatable: true
|
||||
indexes: { }
|
||||
persist_with_no_fields: false
|
||||
custom_storage: false
|
|
@ -7,5 +7,5 @@ dependencies:
|
|||
- farm:farm_field
|
||||
- farm:farm_flag
|
||||
- farm:farm_material
|
||||
- log:log
|
||||
- farm:farm_log
|
||||
- token:token
|
||||
|
|
89
modules/log/input/src/Plugin/Log/LogType/Input.php
Normal file
89
modules/log/input/src/Plugin/Log/LogType/Input.php
Normal file
|
@ -0,0 +1,89 @@
|
|||
<?php
|
||||
|
||||
namespace Drupal\farm_input\Plugin\Log\LogType;
|
||||
|
||||
use Drupal\farm_log\Plugin\Log\LogType\LogTypeBase;
|
||||
|
||||
/**
|
||||
* Provides the input log type.
|
||||
*
|
||||
* @LogType(
|
||||
* id = "input",
|
||||
* label = @Translation("Input"),
|
||||
* )
|
||||
*/
|
||||
class Input extends LogTypeBase {
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function buildFieldDefinitions() {
|
||||
$fields = parent::buildFieldDefinitions();
|
||||
|
||||
// Lot number.
|
||||
$options = [
|
||||
'type' => 'string',
|
||||
'label' => 'Lot number',
|
||||
'description' => 'If this harvest is part of a batch or lot, enter the lot number here.',
|
||||
'weight' => [
|
||||
'form' => -45,
|
||||
'view' => -45,
|
||||
],
|
||||
];
|
||||
$fields['lot_number'] = \Drupal::service('farm_field.factory')->bundleFieldDefinition($options);
|
||||
|
||||
// Material.
|
||||
$options = [
|
||||
'type' => 'entity_reference',
|
||||
'label' => 'Material',
|
||||
'description' => 'What materials are being applied?',
|
||||
'target_type' => 'taxonomy_term',
|
||||
'target_bundle' => 'material',
|
||||
'multiple' => TRUE,
|
||||
'weight' => [
|
||||
'form' => -50,
|
||||
'view' => -50,
|
||||
],
|
||||
];
|
||||
$fields['material'] = \Drupal::service('farm_field.factory')->bundleFieldDefinition($options);
|
||||
|
||||
// Method.
|
||||
$options = [
|
||||
'type' => 'string',
|
||||
'label' => 'Method',
|
||||
'description' => 'How was this input applied?',
|
||||
'weight' => [
|
||||
'form' => -30,
|
||||
'view' => -30,
|
||||
],
|
||||
];
|
||||
$fields['method'] = \Drupal::service('farm_field.factory')->bundleFieldDefinition($options);
|
||||
|
||||
// Purchase date.
|
||||
$options = [
|
||||
'type' => 'timestamp',
|
||||
'label' => 'Purchase date',
|
||||
'description' => 'When was this input purchased (if applicable)?',
|
||||
'weight' => [
|
||||
'form' => -35,
|
||||
'view' => -35,
|
||||
],
|
||||
];
|
||||
$fields['purchase_date'] = \Drupal::service('farm_field.factory')->bundleFieldDefinition($options);
|
||||
|
||||
// Source.
|
||||
$options = [
|
||||
'type' => 'string',
|
||||
'label' => 'Source',
|
||||
'description' => 'Where was this input obtained? Who manufactured it?',
|
||||
'weight' => [
|
||||
'form' => -40,
|
||||
'view' => -40,
|
||||
],
|
||||
];
|
||||
$fields['source'] = \Drupal::service('farm_field.factory')->bundleFieldDefinition($options);
|
||||
|
||||
return $fields;
|
||||
}
|
||||
|
||||
}
|
|
@ -1,18 +0,0 @@
|
|||
langcode: en
|
||||
status: true
|
||||
dependencies:
|
||||
config:
|
||||
- field.storage.log.lab
|
||||
- log.type.lab_test
|
||||
id: log.lab_test.lab
|
||||
field_name: lab
|
||||
entity_type: log
|
||||
bundle: lab_test
|
||||
label: Laboratory
|
||||
description: 'What laboratory performed this test?'
|
||||
required: false
|
||||
translatable: false
|
||||
default_value: { }
|
||||
default_value_callback: ''
|
||||
settings: { }
|
||||
field_type: string
|
|
@ -1,20 +0,0 @@
|
|||
langcode: en
|
||||
status: true
|
||||
dependencies:
|
||||
config:
|
||||
- field.storage.log.lab_test_type
|
||||
- log.type.lab_test
|
||||
module:
|
||||
- options
|
||||
id: log.lab_test.lab_test_type
|
||||
field_name: lab_test_type
|
||||
entity_type: log
|
||||
bundle: lab_test
|
||||
label: Test type
|
||||
description: ''
|
||||
required: false
|
||||
translatable: false
|
||||
default_value: { }
|
||||
default_value_callback: ''
|
||||
settings: { }
|
||||
field_type: list_string
|
|
@ -1,23 +0,0 @@
|
|||
langcode: en
|
||||
status: true
|
||||
dependencies:
|
||||
module:
|
||||
- log
|
||||
- options
|
||||
enforced:
|
||||
module:
|
||||
- farm_lab_test
|
||||
id: log.lab_test_type
|
||||
field_name: lab_test_type
|
||||
entity_type: log
|
||||
type: list_string
|
||||
settings:
|
||||
allowed_values: { }
|
||||
allowed_values_function: 'farm_lab_test_type_field_allowed_values'
|
||||
module: options
|
||||
locked: false
|
||||
cardinality: 1
|
||||
translatable: true
|
||||
indexes: { }
|
||||
persist_with_no_fields: false
|
||||
custom_storage: false
|
|
@ -6,5 +6,5 @@ core_version_requirement: ^9
|
|||
dependencies:
|
||||
- farm:farm_field
|
||||
- farm:farm_flag
|
||||
- log:log
|
||||
- farm:farm_log
|
||||
- token:token
|
||||
|
|
50
modules/log/lab_test/src/Plugin/Log/LogType/LabTest.php
Normal file
50
modules/log/lab_test/src/Plugin/Log/LogType/LabTest.php
Normal file
|
@ -0,0 +1,50 @@
|
|||
<?php
|
||||
|
||||
namespace Drupal\farm_lab_test\Plugin\Log\LogType;
|
||||
|
||||
use Drupal\farm_log\Plugin\Log\LogType\LogTypeBase;
|
||||
|
||||
/**
|
||||
* Provides the lab test log type.
|
||||
*
|
||||
* @LogType(
|
||||
* id = "lab_test",
|
||||
* label = @Translation("LabTest"),
|
||||
* )
|
||||
*/
|
||||
class LabTest extends LogTypeBase {
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function buildFieldDefinitions() {
|
||||
$fields = parent::buildFieldDefinitions();
|
||||
|
||||
// Lab.
|
||||
$options = [
|
||||
'type' => 'string',
|
||||
'label' => 'Laboratory',
|
||||
'description' => 'What laboratory performed this test?',
|
||||
'weight' => [
|
||||
'form' => -40,
|
||||
'view' => -40,
|
||||
],
|
||||
];
|
||||
$fields['lab'] = \Drupal::service('farm_field.factory')->bundleFieldDefinition($options);
|
||||
|
||||
// Lab test type.
|
||||
$options = [
|
||||
'type' => 'list_string',
|
||||
'label' => 'Test type',
|
||||
'allowed_values_function' => 'farm_lab_test_type_field_allowed_values',
|
||||
'weight' => [
|
||||
'form' => -50,
|
||||
'view' => -50,
|
||||
],
|
||||
];
|
||||
$fields['lab_test_type'] = \Drupal::service('farm_field.factory')->bundleFieldDefinition($options);
|
||||
|
||||
return $fields;
|
||||
}
|
||||
|
||||
}
|
|
@ -7,5 +7,5 @@ dependencies:
|
|||
- farm:farm_equipment
|
||||
- farm:farm_field
|
||||
- farm:farm_flag
|
||||
- log:log
|
||||
- farm:farm_log
|
||||
- token:token
|
||||
|
|
|
@ -0,0 +1,17 @@
|
|||
<?php
|
||||
|
||||
namespace Drupal\farm_maintenance\Plugin\Log\LogType;
|
||||
|
||||
use Drupal\farm_log\Plugin\Log\LogType\LogTypeBase;
|
||||
|
||||
/**
|
||||
* Provides the maintenance log type.
|
||||
*
|
||||
* @LogType(
|
||||
* id = "maintenance",
|
||||
* label = @Translation("Maintenance"),
|
||||
* )
|
||||
*/
|
||||
class Maintenance extends LogTypeBase {
|
||||
|
||||
}
|
|
@ -1,18 +0,0 @@
|
|||
langcode: en
|
||||
status: true
|
||||
dependencies:
|
||||
config:
|
||||
- field.storage.log.vet
|
||||
- log.type.medical
|
||||
id: log.medical.vet
|
||||
field_name: vet
|
||||
entity_type: log
|
||||
bundle: medical
|
||||
label: Veterinarian
|
||||
description: 'If a veterinarian was involved, enter their name here.'
|
||||
required: false
|
||||
translatable: false
|
||||
default_value: { }
|
||||
default_value_callback: ''
|
||||
settings: { }
|
||||
field_type: string
|
|
@ -7,5 +7,5 @@ dependencies:
|
|||
- farm:farm_animal
|
||||
- farm:farm_field
|
||||
- farm:farm_flag
|
||||
- log:log
|
||||
- farm:farm_log
|
||||
- token:token
|
||||
|
|
38
modules/log/medical/src/Plugin/Log/LogType/Medical.php
Normal file
38
modules/log/medical/src/Plugin/Log/LogType/Medical.php
Normal file
|
@ -0,0 +1,38 @@
|
|||
<?php
|
||||
|
||||
namespace Drupal\farm_medical\Plugin\Log\LogType;
|
||||
|
||||
use Drupal\farm_log\Plugin\Log\LogType\LogTypeBase;
|
||||
|
||||
/**
|
||||
* Provides the medical log type.
|
||||
*
|
||||
* @LogType(
|
||||
* id = "medical",
|
||||
* label = @Translation("Medical"),
|
||||
* )
|
||||
*/
|
||||
class Medical extends LogTypeBase {
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function buildFieldDefinitions() {
|
||||
$fields = parent::buildFieldDefinitions();
|
||||
|
||||
// Veterinarian.
|
||||
$options = [
|
||||
'type' => 'string',
|
||||
'label' => 'Veterinarian',
|
||||
'description' => 'If a veterinarian was involved, enter their name here.',
|
||||
'weight' => [
|
||||
'form' => -40,
|
||||
'view' => -40,
|
||||
],
|
||||
];
|
||||
$fields['vet'] = \Drupal::service('farm_field.factory')->bundleFieldDefinition($options);
|
||||
|
||||
return $fields;
|
||||
}
|
||||
|
||||
}
|
|
@ -6,5 +6,5 @@ core_version_requirement: ^9
|
|||
dependencies:
|
||||
- farm:farm_field
|
||||
- farm:farm_flag
|
||||
- log:log
|
||||
- farm:farm_log
|
||||
- token:token
|
||||
|
|
|
@ -0,0 +1,17 @@
|
|||
<?php
|
||||
|
||||
namespace Drupal\farm_observation\Plugin\Log\LogType;
|
||||
|
||||
use Drupal\farm_log\Plugin\Log\LogType\LogTypeBase;
|
||||
|
||||
/**
|
||||
* Provides the observation log type.
|
||||
*
|
||||
* @LogType(
|
||||
* id = "observation",
|
||||
* label = @Translation("Observation"),
|
||||
* )
|
||||
*/
|
||||
class Observation extends LogTypeBase {
|
||||
|
||||
}
|
|
@ -1,18 +0,0 @@
|
|||
langcode: en
|
||||
status: true
|
||||
dependencies:
|
||||
config:
|
||||
- field.storage.log.invoice_number
|
||||
- log.type.purchase
|
||||
id: log.purchase.invoice_number
|
||||
field_name: invoice_number
|
||||
entity_type: log
|
||||
bundle: purchase
|
||||
label: 'Invoice number'
|
||||
description: ''
|
||||
required: false
|
||||
translatable: false
|
||||
default_value: { }
|
||||
default_value_callback: ''
|
||||
settings: { }
|
||||
field_type: string
|
|
@ -1,18 +0,0 @@
|
|||
langcode: en
|
||||
status: true
|
||||
dependencies:
|
||||
config:
|
||||
- field.storage.log.seller
|
||||
- log.type.purchase
|
||||
id: log.purchase.seller
|
||||
field_name: seller
|
||||
entity_type: log
|
||||
bundle: purchase
|
||||
label: Seller
|
||||
description: ''
|
||||
required: false
|
||||
translatable: false
|
||||
default_value: { }
|
||||
default_value_callback: ''
|
||||
settings: { }
|
||||
field_type: string
|
|
@ -1,20 +0,0 @@
|
|||
langcode: en
|
||||
status: true
|
||||
dependencies:
|
||||
module:
|
||||
- log
|
||||
id: log.seller
|
||||
field_name: seller
|
||||
entity_type: log
|
||||
type: string
|
||||
settings:
|
||||
max_length: 255
|
||||
is_ascii: false
|
||||
case_sensitive: false
|
||||
module: core
|
||||
locked: false
|
||||
cardinality: 1
|
||||
translatable: true
|
||||
indexes: { }
|
||||
persist_with_no_fields: false
|
||||
custom_storage: false
|
|
@ -6,5 +6,5 @@ core_version_requirement: ^9
|
|||
dependencies:
|
||||
- farm:farm_field
|
||||
- farm:farm_flag
|
||||
- log:log
|
||||
- farm:farm_log
|
||||
- token:token
|
||||
|
|
48
modules/log/purchase/src/Plugin/Log/LogType/Purchase.php
Normal file
48
modules/log/purchase/src/Plugin/Log/LogType/Purchase.php
Normal file
|
@ -0,0 +1,48 @@
|
|||
<?php
|
||||
|
||||
namespace Drupal\farm_purchase\Plugin\Log\LogType;
|
||||
|
||||
use Drupal\farm_log\Plugin\Log\LogType\LogTypeBase;
|
||||
|
||||
/**
|
||||
* Provides the purchase log type.
|
||||
*
|
||||
* @LogType(
|
||||
* id = "purchase",
|
||||
* label = @Translation("Purchase"),
|
||||
* )
|
||||
*/
|
||||
class Purchase extends LogTypeBase {
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function buildFieldDefinitions() {
|
||||
$fields = parent::buildFieldDefinitions();
|
||||
|
||||
// Invoice number.
|
||||
$options = [
|
||||
'type' => 'string',
|
||||
'label' => 'Invoice number',
|
||||
'weight' => [
|
||||
'form' => 20,
|
||||
'view' => 20,
|
||||
],
|
||||
];
|
||||
$fields['invoice_number'] = \Drupal::service('farm_field.factory')->bundleFieldDefinition($options);
|
||||
|
||||
// Seller.
|
||||
$options = [
|
||||
'type' => 'string',
|
||||
'label' => 'Seller',
|
||||
'weight' => [
|
||||
'form' => 20,
|
||||
'view' => 20,
|
||||
],
|
||||
];
|
||||
$fields['seller'] = \Drupal::service('farm_field.factory')->bundleFieldDefinition($options);
|
||||
|
||||
return $fields;
|
||||
}
|
||||
|
||||
}
|
|
@ -1,18 +0,0 @@
|
|||
langcode: en
|
||||
status: true
|
||||
dependencies:
|
||||
config:
|
||||
- field.storage.log.customer
|
||||
- log.type.sale
|
||||
id: log.sale.customer
|
||||
field_name: customer
|
||||
entity_type: log
|
||||
bundle: sale
|
||||
label: Customer
|
||||
description: ''
|
||||
required: false
|
||||
translatable: false
|
||||
default_value: { }
|
||||
default_value_callback: ''
|
||||
settings: { }
|
||||
field_type: string
|
|
@ -1,18 +0,0 @@
|
|||
langcode: en
|
||||
status: true
|
||||
dependencies:
|
||||
config:
|
||||
- field.storage.log.invoice_number
|
||||
- log.type.sale
|
||||
id: log.sale.invoice_number
|
||||
field_name: invoice_number
|
||||
entity_type: log
|
||||
bundle: sale
|
||||
label: 'Invoice number'
|
||||
description: ''
|
||||
required: false
|
||||
translatable: false
|
||||
default_value: { }
|
||||
default_value_callback: ''
|
||||
settings: { }
|
||||
field_type: string
|
|
@ -1,20 +0,0 @@
|
|||
langcode: en
|
||||
status: true
|
||||
dependencies:
|
||||
module:
|
||||
- log
|
||||
id: log.customer
|
||||
field_name: customer
|
||||
entity_type: log
|
||||
type: string
|
||||
settings:
|
||||
max_length: 255
|
||||
is_ascii: false
|
||||
case_sensitive: false
|
||||
module: core
|
||||
locked: false
|
||||
cardinality: 1
|
||||
translatable: true
|
||||
indexes: { }
|
||||
persist_with_no_fields: false
|
||||
custom_storage: false
|
|
@ -6,5 +6,5 @@ core_version_requirement: ^9
|
|||
dependencies:
|
||||
- farm:farm_field
|
||||
- farm:farm_flag
|
||||
- log:log
|
||||
- farm:farm_log
|
||||
- token:token
|
||||
|
|
48
modules/log/sale/src/Plugin/Log/LogType/Sale.php
Normal file
48
modules/log/sale/src/Plugin/Log/LogType/Sale.php
Normal file
|
@ -0,0 +1,48 @@
|
|||
<?php
|
||||
|
||||
namespace Drupal\farm_sale\Plugin\Log\LogType;
|
||||
|
||||
use Drupal\farm_log\Plugin\Log\LogType\LogTypeBase;
|
||||
|
||||
/**
|
||||
* Provides the sale log type.
|
||||
*
|
||||
* @LogType(
|
||||
* id = "sale",
|
||||
* label = @Translation("Sale"),
|
||||
* )
|
||||
*/
|
||||
class Sale extends LogTypeBase {
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function buildFieldDefinitions() {
|
||||
$fields = parent::buildFieldDefinitions();
|
||||
|
||||
// Customer.
|
||||
$options = [
|
||||
'type' => 'string',
|
||||
'label' => 'Customer',
|
||||
'weight' => [
|
||||
'form' => 20,
|
||||
'view' => 20,
|
||||
],
|
||||
];
|
||||
$fields['customer'] = \Drupal::service('farm_field.factory')->bundleFieldDefinition($options);
|
||||
|
||||
// Invoice number.
|
||||
$options = [
|
||||
'type' => 'string',
|
||||
'label' => 'Invoice number',
|
||||
'weight' => [
|
||||
'form' => 20,
|
||||
'view' => 20,
|
||||
],
|
||||
];
|
||||
$fields['invoice_number'] = \Drupal::service('farm_field.factory')->bundleFieldDefinition($options);
|
||||
|
||||
return $fields;
|
||||
}
|
||||
|
||||
}
|
|
@ -1,18 +0,0 @@
|
|||
langcode: en
|
||||
status: true
|
||||
dependencies:
|
||||
config:
|
||||
- field.storage.log.lot_number
|
||||
- log.type.seeding
|
||||
id: log.seeding.lot_number
|
||||
field_name: lot_number
|
||||
entity_type: log
|
||||
bundle: seeding
|
||||
label: 'Lot number'
|
||||
description: 'If the seed is part of a batch or lot, enter the lot number here.'
|
||||
required: false
|
||||
translatable: false
|
||||
default_value: { }
|
||||
default_value_callback: ''
|
||||
settings: { }
|
||||
field_type: string
|
|
@ -1,18 +0,0 @@
|
|||
langcode: en
|
||||
status: true
|
||||
dependencies:
|
||||
config:
|
||||
- field.storage.log.purchase_date
|
||||
- log.type.seeding
|
||||
id: log.seeding.purchase_date
|
||||
field_name: purchase_date
|
||||
entity_type: log
|
||||
bundle: seeding
|
||||
label: 'Purchase date'
|
||||
description: 'When was the seed purchased (if applicable)?'
|
||||
required: false
|
||||
translatable: false
|
||||
default_value: { }
|
||||
default_value_callback: ''
|
||||
settings: { }
|
||||
field_type: timestamp
|
|
@ -1,18 +0,0 @@
|
|||
langcode: en
|
||||
status: true
|
||||
dependencies:
|
||||
config:
|
||||
- field.storage.log.source
|
||||
- log.type.seeding
|
||||
id: log.seeding.source
|
||||
field_name: source
|
||||
entity_type: log
|
||||
bundle: seeding
|
||||
label: Source
|
||||
description: 'Where were the seeds obtained?'
|
||||
required: false
|
||||
translatable: false
|
||||
default_value: { }
|
||||
default_value_callback: ''
|
||||
settings: { }
|
||||
field_type: string
|
|
@ -7,5 +7,5 @@ dependencies:
|
|||
- farm:farm_field
|
||||
- farm:farm_flag
|
||||
- farm:farm_plant
|
||||
- log:log
|
||||
- farm:farm_log
|
||||
- token:token
|
||||
|
|
62
modules/log/seeding/src/Plugin/Log/LogType/Seeding.php
Normal file
62
modules/log/seeding/src/Plugin/Log/LogType/Seeding.php
Normal file
|
@ -0,0 +1,62 @@
|
|||
<?php
|
||||
|
||||
namespace Drupal\farm_seeding\Plugin\Log\LogType;
|
||||
|
||||
use Drupal\farm_log\Plugin\Log\LogType\LogTypeBase;
|
||||
|
||||
/**
|
||||
* Provides the seeding log type.
|
||||
*
|
||||
* @LogType(
|
||||
* id = "seeding",
|
||||
* label = @Translation("Seeding"),
|
||||
* )
|
||||
*/
|
||||
class Seeding extends LogTypeBase {
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function buildFieldDefinitions() {
|
||||
$fields = parent::buildFieldDefinitions();
|
||||
|
||||
// Lot number.
|
||||
$options = [
|
||||
'type' => 'string',
|
||||
'label' => 'Lot number',
|
||||
'description' => 'If this harvest is part of a batch or lot, enter the lot number here.',
|
||||
'weight' => [
|
||||
'form' => 20,
|
||||
'view' => 20,
|
||||
],
|
||||
];
|
||||
$fields['lot_number'] = \Drupal::service('farm_field.factory')->bundleFieldDefinition($options);
|
||||
|
||||
// Purchase date.
|
||||
$options = [
|
||||
'type' => 'timestamp',
|
||||
'label' => 'Purchase date',
|
||||
'description' => 'When was this input purchased (if applicable)?',
|
||||
'weight' => [
|
||||
'form' => -35,
|
||||
'view' => -35,
|
||||
],
|
||||
];
|
||||
$fields['purchase_date'] = \Drupal::service('farm_field.factory')->bundleFieldDefinition($options);
|
||||
|
||||
// Source.
|
||||
$options = [
|
||||
'type' => 'string',
|
||||
'label' => 'Source',
|
||||
'description' => 'Where was this input obtained? Who manufactured it?',
|
||||
'weight' => [
|
||||
'form' => -40,
|
||||
'view' => -40,
|
||||
],
|
||||
];
|
||||
$fields['source'] = \Drupal::service('farm_field.factory')->bundleFieldDefinition($options);
|
||||
|
||||
return $fields;
|
||||
}
|
||||
|
||||
}
|
|
@ -7,5 +7,5 @@ dependencies:
|
|||
- farm:farm_field
|
||||
- farm:farm_flag
|
||||
- farm:farm_plant
|
||||
- log:log
|
||||
- farm:farm_log
|
||||
- token:token
|
||||
|
|
|
@ -0,0 +1,17 @@
|
|||
<?php
|
||||
|
||||
namespace Drupal\farm_transplanting\Plugin\Log\LogType;
|
||||
|
||||
use Drupal\farm_log\Plugin\Log\LogType\LogTypeBase;
|
||||
|
||||
/**
|
||||
* Provides the transplanting log type.
|
||||
*
|
||||
* @LogType(
|
||||
* id = "transplanting",
|
||||
* label = @Translation("Transplanting"),
|
||||
* )
|
||||
*/
|
||||
class Transplanting extends LogTypeBase {
|
||||
|
||||
}
|
Loading…
Reference in a new issue