Added description field to case fee

This commit is contained in:
naomi 2022-05-07 13:56:35 +01:00
parent 5b10fb7328
commit bc442f9842
2 changed files with 31 additions and 1 deletions

View File

@ -1,6 +1,23 @@
<?php <?php
use \Drupal\Core\Field\BaseFieldDefinition; use \Drupal\Core\Field\BaseFieldDefinition;
function opencase_cases_update_90004() {
$field_storage_definition = 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);
\Drupal::entityDefinitionUpdateManager()
->installFieldStorageDefinition('description', 'oc_case_fee', 'opencase_cases', $field_storage_definition);
}
function opencase_cases_update_90002() { function opencase_cases_update_90002() {
$field_storage_definition = BaseFieldDefinition::create('entity_reference') $field_storage_definition = BaseFieldDefinition::create('entity_reference')
->setLabel(t('Target')) ->setLabel(t('Target'))

View File

@ -226,7 +226,9 @@ class OCCaseFee extends EditorialContentEntityBase implements OCCaseFeeInterface
->setDisplayConfigurable('view', TRUE) ->setDisplayConfigurable('view', TRUE)
->setRequired(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('form', TRUE)
->setDisplayConfigurable('view', TRUE); ->setDisplayConfigurable('view', TRUE);
@ -266,6 +268,17 @@ class OCCaseFee extends EditorialContentEntityBase implements OCCaseFeeInterface
->setDisplayConfigurable("view", true) ->setDisplayConfigurable("view", true)
->setDisplayConfigurable("form", true) ->setDisplayConfigurable("form", true)
->setRequired(FALSE); ->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') $fields['amount'] = BaseFieldDefinition::create('decimal')
->setLabel(t('Amount')) ->setLabel(t('Amount'))