Answers.Body: <p>Since this function is used from an ajax callback, your extension could do 2 things:</p>
  
  <ol>
  <li><p>Override the template, which allows you to specify a different ajax path for the dt.</p></li>
  <li><p>Create your own ajax callback which starts by calling that function, then appends its own data.</p></li>
  </ol>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-11-04T18:13:10.397Z
Answers.LastActivityDate: 2016-11-04T18:13:10.397Z
Answers.UserDisplayName: Coleman
Answers.Body: <p>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).</p>
  
  <p>When you add a new relationship to a contact, select the relationship type you want and the new fields will be on it.</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-11-04T14:27:17.100Z
Answers.LastActivityDate: 2016-11-04T14:27:17.100Z
Answers.UserDisplayName: naomi
Body: <p>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. </p>
  
  <p>Adding the fields here in getContactRelationshipSelector makes everything work:</p>
  
  <pre><code> $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); 
  </code></pre>
  
  <p>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.</p>
  
  <p>Not sure how to proceed with implementing this properly as an extension, any tips would be appreciated.</p>
  
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2016-11-04T06:41:06.303Z
Comments.Text: 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
Comments.UserDisplayName: mjcarter
Tags: <extension><hooks><core>
Title: Hacked getContactRelationshipSelector in core, how do I implement as an extension?
ThreadText: # Hacked getContactRelationshipSelector in core, how do I implement as an extension?
  
  (Asked by: username_0 on 2016-11-04)
  
  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.
  
  **Tags:** extension, hooks, core
  
  > **Comments:**
  > **username_0**: 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  
  
  ---
  
  ## 2 answers
  
  ### Answer by username_1 on 2016-11-04. Score: 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.
  
  
  ---
  
  ### Answer by username_2 on 2016-11-04. Score: 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.
  
  
  ---
  
  