diff --git a/modules/zencrm_entities/config/install/views.view.persons.yml b/modules/zencrm_entities/config/install/views.view.persons.yml index 0f2a968..32067e7 100644 --- a/modules/zencrm_entities/config/install/views.view.persons.yml +++ b/modules/zencrm_entities/config/install/views.view.persons.yml @@ -1,5 +1,3 @@ -crm:~/drupal$ - 070f7a04-6bdc-4992-bc48-20803c6ef0f4 langcode: en status: true id: persons diff --git a/modules/zencrm_entities/src/Entity/Profile.php b/modules/zencrm_entities/src/Entity/Profile.php index f6094fc..d58acb5 100644 --- a/modules/zencrm_entities/src/Entity/Profile.php +++ b/modules/zencrm_entities/src/Entity/Profile.php @@ -224,9 +224,34 @@ class Profile extends RevisionableContentEntityBase implements ProfileInterface 'autocomplete_type' => 'tags', 'placeholder' => '', ], + ]); + + $fields['person'] = BaseFieldDefinition::create('entity_reference') + ->setLabel(t('Person')) + ->setDescription(t('The person this profile is of.')) + ->setSetting('target_type', 'person') + ->setSetting('handler', 'views') + ->setSetting('handler_settings', [ + 'view' => [ + 'view_name' => 'persons', + 'display_name' => 'entity_reference_1', + 'arguments' => [] + ] ]) - ->setDisplayConfigurable('form', TRUE) - ->setDisplayConfigurable('view', TRUE); + ->setDisplayOptions('form', [ + 'type' => 'entity_reference_autocomplete', + 'weight' => 5, + 'settings' => [ + 'match_operator' => 'CONTAINS', + 'size' => '60', + 'autocomplete_type' => 'tags', + 'placeholder' => '', + ], + ]) + ->setDisplayOptions('view', [ + 'label' => 'above', + 'weight' => 0, + ]); $fields['name'] = BaseFieldDefinition::create('string') ->setLabel(t('Name'))