3

Here's what I'm trying to do. I installed CiviCRM with CiviCRM Entities. + few other modules.

At Structure -> CiviCRM Entity -> CiviCRM Contact -> Add custom field (CiviCRM Entity Reference)

I did add a custom field called tags. Connected to Tag Entity. It will appear in display. But tags are numbers.

Now i need to fetch tag names from Tag Entity.

I tried to add it in Contact and with Tag Entity itself. Did try to add custom field just like Contact.

(Target: Tag, Join: Tag ID, Host Source: ID).

It won't work. Apparently there's no way to get Tag from Tag Entity for me.

I wonder what's going wrong in here. Can anybody help?

1 Answer 1

3

I need to add an option "Tag ID" in the Host Source Column field setting of the CiviCRM Entity Reference module to make this work.

It won't take much to add it. Look in your code to the matching file, add:

'tag_id' => 'Tag ID (Entity Tag)',

https://github.com/eileenmcnaughton/civicrm_entity/blob/7.x-2.x/modules/civicrm_entity_reference_field/civicrm_entity_reference_field.module#L148

Then you can add another CiviCRM Entity Reference Field to the Entity tag entity type: admin/structure/civicrm-entity/civicrm_entity_tag/fields Target Entity: Tag Target ID: Tag ID Host source column: Tag ID (Entity Tag)

Set this field to render in a view mode on the entity tag manage display area:

admin/structure/civicrm-entity/civicrm_entity_tag/display

This will render the tag entity, you can configure which fields of the tag entity show by configuring a view mode and configuring to use it on the render

admin/structure/civicrm-entity/civicrm_tag/display

Now back at your Contact, make sure and render the view mode of Entity Tag, that renders the right view mode of the Tag entity, and you'll be rocking.

I will add a PR to CiviCRM Entity to add the one line of code necessary to make it work out of the box, but it may be a couple weeks before the next release goes out.

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.