You are here

function _civicrm_entity_contact_group_assign_field_get_field_settings_groups in CiviCRM Entity 7.2

Helper function to get an array of group titles keyed by group id

Parameters

$field:

Return value

array

2 calls to _civicrm_entity_contact_group_assign_field_get_field_settings_groups()
civicrm_entity_contact_group_assign_field_field_widget_form in modules/civicrm_entity_contact_group_assign_field/civicrm_entity_contact_group_assign_field.module
Implements hook_field_widget_form().
_civicrm_entity_contact_group_assign_field_process_field_items in modules/civicrm_entity_contact_group_assign_field/civicrm_entity_contact_group_assign_field.module
Helper function to process field items on entity insert or update

File

modules/civicrm_entity_contact_group_assign_field/civicrm_entity_contact_group_assign_field.module, line 454
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_get_field_settings_groups($field) {
  civicrm_initialize();
  $groups = array();
  foreach ($field['settings']['groups'] as $id => $gid) {
    try {
      $result = civicrm_api3('Group', 'getvalue', array(
        'return' => "title",
        'id' => $gid,
      ));
      $groups[$id] = $result;
    } catch (CiviCRM_API3_Exception $e) {
      continue;
    }
  }
  return $groups;
}