- Issue created by @jdleonard
- πΊπΈUnited States bluegeek9
The individual/person full_name should be able to render differently in a view. Rendering the field based on the viewer's language is in the backlog, β¨ Translate name formats by language Active
The individual/person name field is a string and the format is chosen on save. All persons/individuals should have the same name format for consistency;
The crm_user (crm_user_contact) allows the contact's name to be used for the user's display name. Maybe a name format field could be added to allow the user to select the format for their display name.
- πΊπΈUnited States jdleonard Austin, TX, USA
I'm struggling to wrap my head around the various levels of indirection at play here, but let me try proposing an approach that provides maximum flexibility and seems easy enough to implement:
- Provide some sensible name formats, catering to known name format preferences around the world (and accounting for preferred name)
- Provide a CRM setting "Default contact name format" that lets the CRM admin select the default name format from the list of name formats for CRM functionality
- Provide an optional "Contact name format" field on the Drupal User entity that overrides the Default contact name format
- Scrap the name-related logic in
Contact::preSave()
- Implement
Contact::label()
to return the appropriately formatted value from thefull_name
field (using the User's Contact name format if set, otherwise the Default contact name format) in the case of an Individual and otherwise the value of thename
base field - Remove the
label
key from Contact'sentity_keys
- superseded by thelabel()
override
- πΊπΈUnited States bluegeek9
CRM Core implemented:
- Implement Contact::label() to return the appropriately formatted value from the full_name field (using the User's Contact name format if set, otherwise the Default contact name format) in the case of an Individual and otherwise the value of the name base field
- Remove the label key from Contact's entity_keys - superseded by the label() override
It was bad. Because of the name field, autocomplete was unusable after a couple hundred contacts. Sorting was also an issue
The current design is a response to that architecture.
Provide an optional "Contact name format" field on the Drupal User entity that overrides the Default contact name format for that User when they're logged in
This is not meant to override the contact's name. It overrides the user's name; $user->getDisplayName();
- πΊπΈUnited States jdleonard Austin, TX, USA
Now I understand the current design :)
It's more work, but I propose that we adopt Search API. This will be something commonly adopted for more intense use cases and it will benefit performance for the small ones too. Even the default database Search API backend (paired with a Search API Views-based autocomplete) would solve the autocomplete performance issue you describe CRM Core having faced, right?
Provide an optional "Contact name format" field on the Drupal User entity that overrides the Default contact name format for that User when they're logged in
I intended this as a User preference for how all Contacts' names should be rendered for that User ("I live in [country] and American name formats detract from a positive user experience")
- πΊπΈUnited States bluegeek9
I intended this as a User preference for how all Contacts' names should be rendered for that User ("I live in [country] and American name formats detract from a positive user experience")
This is an issue for the name backlog, β¨ Translate name formats by language Active
The search API will not solve the problem. At best it will cover it up until a site builder does something custom.
I am hesitant to adopt dependencies unless necessary.
- πΊπΈUnited States bluegeek9
There are issues with name and the search API:
#2908703: Search API full name field β
π¬ Search in Views ActiveA sitebuilder can make an Entity Reference Display to make it look however they want. The contact.name is a static field that is easy to filter.
- πΊπΈUnited States bluegeek9
I created an issue for customizing the User's display name: β¨ User Display Name preference Active
I think we should use the default name format for the Person's label. We could also add a global setting to use a different format.