You are here

function civicrm_entity_contact_group_assign_field_field_update in CiviCRM Entity 7.2

Implements hook_field_update().

Parameters

$entity_type:

$entity:

$field:

$instance:

$langcode:

$items:

File

modules/civicrm_entity_contact_group_assign_field/civicrm_entity_contact_group_assign_field.module, line 180
Provide CiviCRM Entity Contact Group Assign Field Type. Provides a widget for adding/removing a contact to a selected list of groups.

Code

function civicrm_entity_contact_group_assign_field_field_update($entity_type, $entity, $field, $instance, $langcode, &$items) {
  if ($entity_type == 'civicrm_contact') {
    if (!empty($items[0]['groups'])) {
      if (!empty($entity->id)) {
        $contact_id = $entity->id;
        _civicrm_entity_contact_group_assign_field_process_field_items($contact_id, $field, $items);
        unset($items[0]);
      }
    }
  }
}