Added base field "contact role" to organisation, and bumped version

This commit is contained in:
Naomi 2021-06-15 19:55:45 +02:00
parent 1cb3a4356a
commit 3f3945f9a0
3 changed files with 46 additions and 2 deletions

View File

@ -2,6 +2,31 @@
use \Drupal\Core\Entity\Sql\SqlContentEntityStorageSchemaConverter;
use \Drupal\Core\Field\BaseFieldDefinition;
function opencase_entities_update_80199() {
$field_storage_definition = BaseFieldDefinition::create('string')
->setLabel(t('Contact Role'))
->setDescription(t('Role of the contact within the organisation'))
->setRevisionable(TRUE)
->setSettings([
'max_length' => 50,
'text_processing' => 0,
])
->setDefaultValue('')
->setDisplayOptions('view', [
'label' => 'above',
'type' => 'string',
'weight' => 52,
])
->setDisplayOptions('form', [
'type' => 'string_textfield',
'weight' => 52,
])
->setRequired(FALSE);
\Drupal::entityDefinitionUpdateManager()
->installFieldStorageDefinition('contact_role', 'oc_organisation', 'opencase_entities', $field_storage_definition);
}
function opencase_entities_update_80198() {
$field_storage_definition = \Drupal\Core\Field\BaseFieldDefinition::create('file')

View File

@ -213,7 +213,7 @@ class OCOrganisation extends EditorialContentEntityBase implements OCOrganisatio
));
$fields['contact_name'] = BaseFieldDefinition::create('string')
->setLabel(t('Contact Name'))
->setDescription(t('Name of the main contact for this client.'))
->setDescription(t('Name of the main contact for this organisation.'))
->setRevisionable(TRUE)
->setSettings([
'max_length' => 50,
@ -231,6 +231,25 @@ class OCOrganisation extends EditorialContentEntityBase implements OCOrganisatio
])
->setRequired(FALSE);
$fields['contact_role'] = BaseFieldDefinition::create('string')
->setLabel(t('Contact Role'))
->setDescription(t('Role of the contact within the organisation'))
->setRevisionable(TRUE)
->setSettings([
'max_length' => 50,
'text_processing' => 0,
])
->setDefaultValue('')
->setDisplayOptions('view', [
'label' => 'above',
'type' => 'string',
'weight' => 52,
])
->setDisplayOptions('form', [
'type' => 'string_textfield',
'weight' => 52,
])
->setRequired(FALSE);
$fields['email'] = BaseFieldDefinition::create('string')
->setLabel(t('Email Address'))
->setRevisionable(TRUE)

View File

@ -2,7 +2,7 @@ name: 'OpenCase'
type: module
description: 'Simple Case Management'
core: 8.x
version: 8.x-1.9.8
version: 8.x-1.9.9
package: 'OpenCase'
dependencies:
- opencase_entities