function civicrm_entity_contact_assign_rel_contact_field_civicrm_post in CiviCRM Entity 7.2
Implements hook_civicrm_post().
Here we need to probably clear some field caches when contacts are added / removed from group
Parameters
$op:
$objectName:
$objectId:
$objectRef:
File
- modules/
civicrm_entity_contact_assign_rel_contact_field/ civicrm_entity_contact_assign_rel_contact_field.module, line 551 - Provide CiviCRM Entity Contact Assign Relationship Contacts List Field Type. Provides a widget for adding/removing a contacts relationships to a list of contacts.
Code
function civicrm_entity_contact_assign_rel_contact_field_civicrm_post($op, $objectName, $objectId, &$objectRef) {
if ($objectName == 'Relationship' && ($op == 'create' || $op == 'delete' || $op == 'edit')) {
$fields = db_select('field_config', 'fc')
->fields('fc', array(
'id',
))
->condition('type', 'civicrm_entity_contact_assign_rel_contact_field')
->execute();
$contact_a_id = $objectRef->contact_id_a;
if ($fields
->rowCount()) {
cache_clear_all('field:civicrm_contact:' . $contact_a_id, 'cache_field');
}
}
}