1

I'm looking to show additional fields in the relationship tab for contacts (e.g. Job Title) - the fields are part of the relationship object, but aren't defined in getContactRelationshipSelector (CRM\Contact\BAO\Relationship.php) and attempting to use them as columns in the table via editing the template gives an error.

Adding the fields here in getContactRelationshipSelector makes everything work:

 $relationship['start_date'] = CRM_Utils_Date::customFormat($values['start_date']);
        $relationship['end_date'] = CRM_Utils_Date::customFormat($values['end_date']);
        $relationship['city'] = $values['city'];
        $relationship['state'] = $values['state'];
        $relationship['email'] = $values['email'];
        $relationship['phone'] = $values['phone'];
        $relationship['job_title'] = $values['job_title'];
        $relationship['links'] = $values['action'];

        array_push($contactRelationships, $relationship); 

I started making an extension to implement hook_getContactRelationshipSelector - but this doesn't seem to exist, or at least there's no reference to it in the documentation and test code didn't seem to do anything.

Not sure how to proceed with implementing this properly as an extension, any tips would be appreciated.

  • I had it in my head that custom directory PHP files could only be those directly related to templates as that's all I'd ever seen and worked with in the past - about ten seconds after posting this it struck me that perhaps all the PHP files in the /CRM folder could be edited this way, and so I've no longer got a core file hacked. Am still interested in hearing how/if this could be implemented as an extension if anyone has ideas – mjcarter Nov 4 '16 at 6:41
1

Since this function is used from an ajax callback, your extension could do 2 things:

  1. Override the template, which allows you to specify a different ajax path for the dt.

  2. Create your own ajax callback which starts by calling that function, then appends its own data.

0

You can use custom fields for this. You will need to create a relationship type (Administer->Customise Data and Fields->Relationship Types) first and then define some custom fields on it (Administer->Customise Data and Fields->Custom Fields).

When you add a new relationship to a contact, select the relationship type you want and the new fields will be on it.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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