In process with Contact Details type field.

This commit is contained in:
naomi 2018-04-06 13:43:25 +02:00
parent 54f9366fff
commit 599ee239ff

View File

@ -224,15 +224,16 @@ class ContactDetails extends RevisionableContentEntityBase implements ContactDet
->setDisplayConfigurable('form', TRUE) ->setDisplayConfigurable('form', TRUE)
->setDisplayConfigurable('view', TRUE); ->setDisplayConfigurable('view', TRUE);
// This field is not displayed but is used to compute the name of the entity.
$fields['label'] = BaseFieldDefinition::create('entity_reference') // See zencrm_entities.module - zencrm_entities_contact_details_presave().
->setLabel(t('Label')) $fields['type'] = BaseFieldDefinition::create('entity_reference')
->setLabel(t('Type'))
->setDescription(t('E.g. Home, Business, Temporary')) ->setDescription(t('E.g. Home, Business, Temporary'))
->setSetting('handler', 'default:taxonomy_term') ->setSetting('handler', 'default:taxonomy_term')
->setSetting('target_type', 'taxonomy_term') ->setSetting('target_type', 'taxonomy_term')
->setSetting('handler_settings', [ ->setSetting('handler_settings', [
'target_bundles' => [ 'target_bundles' => [
'tags' => 'tags', 'contact_details_types' => 'contact_details_types',
], ],
'auto_create' => 'true' 'auto_create' => 'true'
]) ])
@ -290,7 +291,6 @@ class ContactDetails extends RevisionableContentEntityBase implements ContactDet
'max_length' => 50, 'max_length' => 50,
'text_processing' => 0, 'text_processing' => 0,
]) ])
->setDefaultValue('')
->setDisplayOptions('view', [ ->setDisplayOptions('view', [
'label' => 'above', 'label' => 'above',
'type' => 'string', 'type' => 'string',
@ -299,10 +299,7 @@ class ContactDetails extends RevisionableContentEntityBase implements ContactDet
->setDisplayOptions('form', [ ->setDisplayOptions('form', [
'type' => 'string_textfield', 'type' => 'string_textfield',
'weight' => -4, 'weight' => -4,
]) ]);
->setDisplayConfigurable('form', TRUE)
->setDisplayConfigurable('view', TRUE)
->setRequired(TRUE);
$fields['status'] = BaseFieldDefinition::create('boolean') $fields['status'] = BaseFieldDefinition::create('boolean')
->setLabel(t('Publishing status')) ->setLabel(t('Publishing status'))