Added full_name and first_and_last_name fields to the Person entity type.

The full name is now the entity label. The first_and_last_name is so that it can be used in search and autocomplete.
This commit is contained in:
naomi
2018-04-05 23:02:55 +02:00
parent 7ac39fc385
commit 6cf7d5ee6f
2 changed files with 30 additions and 0 deletions

View File

@ -49,6 +49,7 @@ use Drupal\user\UserInterface;
* "uid" = "user_id",
* "langcode" = "langcode",
* "status" = "status",
* "label" = "full_name",
* },
* links = {
* "canonical" = "/zencrm/person/{person}",
@ -192,6 +193,16 @@ class Person extends RevisionableContentEntityBase implements PersonInterface {
->setSetting('handler', 'default')
->setTranslatable(TRUE);
$fields['full_name'] = BaseFieldDefinition::create('string')
->setLabel(t('Full Name'))
->setDescription(t('The full name of the person.'))
->setRevisionable(TRUE);
$fields['first_and_last_name'] = BaseFieldDefinition::create('string')
->setLabel(t('First and Last Name'))
->setDescription(t('The first and last name of the person. Used for searching and autocomplete'))
->setRevisionable(TRUE);
$fields['first_name'] = BaseFieldDefinition::create('string')
->setLabel(t('First Name'))
->setDescription(t('First Name.'))