This commit is contained in:
Michael Stenta 2024-01-16 17:58:15 -08:00 committed by GitHub
commit 11186e00f9
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 37 additions and 0 deletions

View File

@ -11,6 +11,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- [Add min/max options to integer fields in farm_field.factory #768](https://github.com/farmOS/farmOS/pull/768)
### Changed
- [Override the lab_test log timestamp label and description #774](https://github.com/farmOS/farmOS/pull/774)
### Fixed
- [Patch drupal/core to fix Issue #3414883: datetime_timestamp widget does not use default field value #771](https://github.com/farmOS/farmOS/pull/771)

View File

@ -0,0 +1,20 @@
langcode: en
status: true
dependencies:
config:
- log.type.lab_test
enforced:
module:
- farm_lab_test
id: log.lab_test.timestamp
field_name: timestamp
entity_type: log
bundle: lab_test
label: 'Date sampled'
description: 'The date when the sample was collected.'
required: true
translatable: true
default_value: { }
default_value_callback: 'Drupal\log\Entity\Log::getRequestTime'
settings: { }
field_type: timestamp

View File

@ -176,3 +176,16 @@ function farm_lab_test_post_update_add_tissue_type(&$sandbox) {
]);
$type->save();
}
/**
* Override the lab_test log timestamp label and description.
*/
function farm_lab_test_post_update_override_lab_test_timestamp_label_description(&$sandbox) {
// Override the timestamp field label and description on lab_test logs to
// make it clear that it should be used for the date the sample was taken.
$config = \Drupal::service('entity_field.manager')->getBaseFieldDefinitions('log')['timestamp']->getConfig('lab_test');
$config->set('label', 'Date sampled');
$config->set('description', 'The date when the sample was collected.');
$config->save();
}