3
0
Fork 0
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:
Michael Stenta 2020-12-10 21:24:22 -05:00
parent 273daf9697
commit 84dc39d9e2
49 changed files with 452 additions and 530 deletions

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -6,5 +6,5 @@ core_version_requirement: ^9
dependencies:
- farm:farm_field
- farm:farm_flag
- log:log
- farm:farm_log
- token:token

View 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 {
}

View file

@ -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

View file

@ -6,5 +6,5 @@ core_version_requirement: ^9
dependencies:
- farm:farm_field
- farm:farm_flag
- log:log
- farm:farm_log
- token:token

View 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;
}
}

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -7,5 +7,5 @@ dependencies:
- farm:farm_field
- farm:farm_flag
- farm:farm_material
- log:log
- farm:farm_log
- token:token

View 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;
}
}

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -6,5 +6,5 @@ core_version_requirement: ^9
dependencies:
- farm:farm_field
- farm:farm_flag
- log:log
- farm:farm_log
- token:token

View 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;
}
}

View file

@ -7,5 +7,5 @@ dependencies:
- farm:farm_equipment
- farm:farm_field
- farm:farm_flag
- log:log
- farm:farm_log
- token:token

View file

@ -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 {
}

View file

@ -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

View file

@ -7,5 +7,5 @@ dependencies:
- farm:farm_animal
- farm:farm_field
- farm:farm_flag
- log:log
- farm:farm_log
- token:token

View 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;
}
}

View file

@ -6,5 +6,5 @@ core_version_requirement: ^9
dependencies:
- farm:farm_field
- farm:farm_flag
- log:log
- farm:farm_log
- token:token

View file

@ -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 {
}

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -6,5 +6,5 @@ core_version_requirement: ^9
dependencies:
- farm:farm_field
- farm:farm_flag
- log:log
- farm:farm_log
- token:token

View 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;
}
}

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -6,5 +6,5 @@ core_version_requirement: ^9
dependencies:
- farm:farm_field
- farm:farm_flag
- log:log
- farm:farm_log
- token:token

View 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;
}
}

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -7,5 +7,5 @@ dependencies:
- farm:farm_field
- farm:farm_flag
- farm:farm_plant
- log:log
- farm:farm_log
- token:token

View 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;
}
}

View file

@ -7,5 +7,5 @@ dependencies:
- farm:farm_field
- farm:farm_flag
- farm:farm_plant
- log:log
- farm:farm_log
- token:token

View file

@ -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 {
}