function civicrm_entity_civicrm_contact_label_callback in CiviCRM Entity 7
Same name and namespace in other branches
- 7.2 civicrm_entity.module \civicrm_entity_civicrm_contact_label_callback()
Label callback for civicrm_contact entity type.
drupal_alter('civicrm_entity_' . $entity, $, $alterable2, $context);
_type
Parameters
$entity:
Return value
null|string
File
- ./
civicrm_entity.module, line 389 - Implement CiviCRM entities as a Drupal Entity.
Code
function civicrm_entity_civicrm_contact_label_callback($entity, $entity_type) {
$label = isset($entity->display_name) ? $entity->display_name : '';
// drupal_alter('civicrm_entity_contact_label', $label, $entity);
if (isset($entity->email) && !empty($entity->email)) {
$label = t('!label <!email>', array(
'!label' => $label,
'!email' => $entity->email,
));
}
elseif (isset($entity->phone) && !empty($entity->phone)) {
$label = t('!label <!phone>', array(
'!label' => $label,
'!phone' => $entity->phone,
));
}
return $label;
}