From 599ee239ffce460f54abbec3a8e9df4f72682ca8 Mon Sep 17 00:00:00 2001 From: naomi Date: Fri, 6 Apr 2018 13:43:25 +0200 Subject: [PATCH] In process with Contact Details type field. --- .../zencrm_entities/src/Entity/ContactDetails.php | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/modules/zencrm_entities/src/Entity/ContactDetails.php b/modules/zencrm_entities/src/Entity/ContactDetails.php index 119fb76..b9680fc 100644 --- a/modules/zencrm_entities/src/Entity/ContactDetails.php +++ b/modules/zencrm_entities/src/Entity/ContactDetails.php @@ -224,15 +224,16 @@ class ContactDetails extends RevisionableContentEntityBase implements ContactDet ->setDisplayConfigurable('form', TRUE) ->setDisplayConfigurable('view', TRUE); - - $fields['label'] = BaseFieldDefinition::create('entity_reference') - ->setLabel(t('Label')) + // This field is not displayed but is used to compute the name of the entity. + // See zencrm_entities.module - zencrm_entities_contact_details_presave(). + $fields['type'] = BaseFieldDefinition::create('entity_reference') + ->setLabel(t('Type')) ->setDescription(t('E.g. Home, Business, Temporary')) ->setSetting('handler', 'default:taxonomy_term') ->setSetting('target_type', 'taxonomy_term') ->setSetting('handler_settings', [ 'target_bundles' => [ - 'tags' => 'tags', + 'contact_details_types' => 'contact_details_types', ], 'auto_create' => 'true' ]) @@ -290,7 +291,6 @@ class ContactDetails extends RevisionableContentEntityBase implements ContactDet 'max_length' => 50, 'text_processing' => 0, ]) - ->setDefaultValue('') ->setDisplayOptions('view', [ 'label' => 'above', 'type' => 'string', @@ -299,10 +299,7 @@ class ContactDetails extends RevisionableContentEntityBase implements ContactDet ->setDisplayOptions('form', [ 'type' => 'string_textfield', 'weight' => -4, - ]) - ->setDisplayConfigurable('form', TRUE) - ->setDisplayConfigurable('view', TRUE) - ->setRequired(TRUE); + ]); $fields['status'] = BaseFieldDefinition::create('boolean') ->setLabel(t('Publishing status'))