From bc442f98421b497bb45ede647b4d94672dc273aa Mon Sep 17 00:00:00 2001 From: naomi Date: Sat, 7 May 2022 13:56:35 +0100 Subject: [PATCH] Added description field to case fee --- modules/opencase_cases/opencase_cases.install | 17 +++++++++++++++++ modules/opencase_cases/src/Entity/OCCaseFee.php | 15 ++++++++++++++- 2 files changed, 31 insertions(+), 1 deletion(-) diff --git a/modules/opencase_cases/opencase_cases.install b/modules/opencase_cases/opencase_cases.install index 7ecfaed..6878285 100644 --- a/modules/opencase_cases/opencase_cases.install +++ b/modules/opencase_cases/opencase_cases.install @@ -1,6 +1,23 @@ setRevisionable(TRUE) + ->setLabel(t('Description')) + ->setSettings(array( + 'default_value' => '', + 'max_length' => 255, + 'text_processing' => 0, + )) + ->setDisplayConfigurable('form', true) + ->setDisplayConfigurable('view', true); + + + \Drupal::entityDefinitionUpdateManager() + ->installFieldStorageDefinition('description', 'oc_case_fee', 'opencase_cases', $field_storage_definition); +} + function opencase_cases_update_90002() { $field_storage_definition = BaseFieldDefinition::create('entity_reference') ->setLabel(t('Target')) diff --git a/modules/opencase_cases/src/Entity/OCCaseFee.php b/modules/opencase_cases/src/Entity/OCCaseFee.php index a73ff13..a10cf44 100644 --- a/modules/opencase_cases/src/Entity/OCCaseFee.php +++ b/modules/opencase_cases/src/Entity/OCCaseFee.php @@ -226,7 +226,9 @@ class OCCaseFee extends EditorialContentEntityBase implements OCCaseFeeInterface ->setDisplayConfigurable('view', TRUE) ->setRequired(TRUE); - $fields['status']->setDescription(t('A boolean indicating whether the Case Fee is published.')) + $fields['status'] = BaseFieldDefinition::create('boolean') + ->setLabel(t('Visible')) + ->setDescription(t('A boolean indicating whether the Case Fee is published.')) ->setDisplayConfigurable('form', TRUE) ->setDisplayConfigurable('view', TRUE); @@ -266,6 +268,17 @@ class OCCaseFee extends EditorialContentEntityBase implements OCCaseFeeInterface ->setDisplayConfigurable("view", true) ->setDisplayConfigurable("form", true) ->setRequired(FALSE); + + $fields['description'] = BaseFieldDefinition::create('string_long') + ->setRevisionable(TRUE) + ->setLabel(t('Description')) + ->setSettings(array( + 'default_value' => '', + 'max_length' => 255, + 'text_processing' => 0, + )) + ->setDisplayConfigurable('form', true) + ->setDisplayConfigurable('view', true); $fields['amount'] = BaseFieldDefinition::create('decimal') ->setLabel(t('Amount'))