From 41505594be59652e66e5722c24452e299ee9e554 Mon Sep 17 00:00:00 2001 From: Naomi Date: Tue, 15 Jun 2021 20:13:42 +0200 Subject: [PATCH] Added website field to org, and bumped version (to 2.0.0 because ran out of numbers) --- .../opencase_entities.install | 24 +++++++++++++++++++ .../src/Entity/OCOrganisation.php | 18 ++++++++++++++ opencase.info.yml | 2 +- 3 files changed, 43 insertions(+), 1 deletion(-) diff --git a/modules/opencase_entities/opencase_entities.install b/modules/opencase_entities/opencase_entities.install index 3d7a8f5..b0513b4 100644 --- a/modules/opencase_entities/opencase_entities.install +++ b/modules/opencase_entities/opencase_entities.install @@ -4,6 +4,30 @@ use \Drupal\Core\Entity\Sql\SqlContentEntityStorageSchemaConverter; use \Drupal\Core\Field\BaseFieldDefinition; +function opencase_entities_update_80200() { + $field_storage_definition = BaseFieldDefinition::create('string') + ->setLabel(t('Website')) + ->setRevisionable(TRUE) + ->setSettings([ + 'max_length' => 50, + 'text_processing' => 0, + ]) + ->setDefaultValue('') + ->setDisplayOptions('view', [ + 'label' => 'above', + 'type' => 'string', + 'weight' => 49, + ]) + ->setDisplayOptions('form', [ + 'type' => 'string_textfield', + 'weight' => 49, + ]) + ->setRequired(FALSE); + + \Drupal::entityDefinitionUpdateManager() + ->installFieldStorageDefinition('org_website', 'oc_organisation', 'opencase_entities', $field_storage_definition); +} + function opencase_entities_update_80199() { $field_storage_definition = BaseFieldDefinition::create('string') ->setLabel(t('Contact Role')) diff --git a/modules/opencase_entities/src/Entity/OCOrganisation.php b/modules/opencase_entities/src/Entity/OCOrganisation.php index df080a2..b805251 100644 --- a/modules/opencase_entities/src/Entity/OCOrganisation.php +++ b/modules/opencase_entities/src/Entity/OCOrganisation.php @@ -211,6 +211,24 @@ class OCOrganisation extends EditorialContentEntityBase implements OCOrganisatio 'type' => 'string_textarea', 'weight' => 50, )); + $fields['website'] = BaseFieldDefinition::create('string') + ->setLabel(t('Website')) + ->setRevisionable(TRUE) + ->setSettings([ + 'max_length' => 50, + 'text_processing' => 0, + ]) + ->setDefaultValue('') + ->setDisplayOptions('view', [ + 'label' => 'above', + 'type' => 'string', + 'weight' => 49, + ]) + ->setDisplayOptions('form', [ + 'type' => 'string_textfield', + 'weight' => 49, + ]) + ->setRequired(FALSE); $fields['contact_name'] = BaseFieldDefinition::create('string') ->setLabel(t('Contact Name')) ->setDescription(t('Name of the main contact for this organisation.')) diff --git a/opencase.info.yml b/opencase.info.yml index c713b1e..8e97f49 100644 --- a/opencase.info.yml +++ b/opencase.info.yml @@ -2,7 +2,7 @@ name: 'OpenCase' type: module description: 'Simple Case Management' core: 8.x -version: 8.x-1.9.9 +version: 8.x-2.0.0 package: 'OpenCase' dependencies: - opencase_entities