You are here

function civicrm_entity_contact_get_location_element in CiviCRM Entity 7.2

Parameters

$contact:

$location_type_id:

Return value

array|bool

2 calls to civicrm_entity_contact_get_location_element()
civicrm_entity_contact_get_email in ./civicrm_entity.module
civicrm_entity_contact_has_location_element_email in ./civicrm_entity.module

File

./civicrm_entity.module, line 3285

Code

function civicrm_entity_contact_get_location_element($entity, &$contact, $location_type_id) {
  $params = array(
    'contact_id' => $contact->id,
    'sequential' => 1,
    'on_hold' => 0,
  );
  if ($location_type_id) {
    $params['location_type_id'] = $location_type_id;
  }
  else {
    $params['is_primary'] = 1;
  }
  $result = civicrm_api3($entity, 'get', $params);
  if (!$result['count']) {
    return array(
      'civicrm_' . $entity => '',
    );
  }
  return array(
    'fetched_' . $entity => $result['values'][0][$entity],
  );
}