3

I have a content type in Drupal ('Event') that uses an entity reference autocomplete field to search the name of the submitting organization. The entity reference field only displays contacts that meet a filter criteria, as set in the entity reference view.

When the content type with the entity reference field was originally set up, it functioned as expected. About a month ago I noticed the display was suddenly showing the submitting organizations' email address in addition to just their name. The problem is specifically in the display of the event after it has been created (the way the name appears in the autocomplete widget is fine).

The display was originally: "Event facilitator: Random Organization Name"

Now, it appears like this, with the addition of their email address: "Event facilitator: Random Organization Name <[email protected]>"

I'd rather not have their email addresses be displayed.

Thinking that it might have had something to do with an update, we downgraded CiviCRM Entity back to version 7.x-2.0-beta11, but the problem persists.

Has anybody experienced this issue? Any help or insight is greatly appreciated.

Using CiviCRM 5.3.1.

1
  • I can help you with this, will provide answer this weekend. Commented Aug 3, 2018 at 16:31

2 Answers 2

1

This was considered a feature by some folks, other folks maybe not.

You need a small custom module to change this... It should implement hook_entity_info_alter(&$entity_info)

https://api.drupal.org/api/drupal/modules%21system%21system.api.php/function/hook_entity_info_alter/7.x

you would need this code:

function YOURMODULE_entity_info_alter(&$entity_info) {
  unset($entity_info['civicrm_contact']['label callback']);
}

Install your module, clear caches.

That will make CiviCRM Entity default the contact entity label to just the display_name, which in your case would be the organization name.

1
  • Thanks! It does seem to me that exposing email addresses by default like this is not a good feature.
    – Alan Dixon
    Commented Aug 8, 2018 at 20:08
4

Congratulations, you're the winner of jackrabbithanna's Friday open source evening random issue choice award!

I've added a configuration option to CiviCRM Entity to be able choose a few options for what the civicrm contact entity label should be.

You'll find a fieldset 'Options' at the configuration page: 'admin/structure/civicrm-entity/settings'

There's a field, "Contact Entity Label"...The default option is "Legacy", which will follow the logic for formatting of the contact entity label that existed previously to this update. Users who upgrade and don't choose an option will have it behave as it did before.

You can also choose, "Display Name only", "Display Name + email", "Display Name + phone", or "Display Name + IM"..

It's available in the 7.x-2.x-dev version right now, will be in version 2.2

Or apply the code updates in this pull request: https://github.com/eileenmcnaughton/civicrm_entity/pull/165/files

1
  • This is a good feature! Thank you so much!
    – Kaitlyn B
    Commented Aug 12, 2018 at 17:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.