You are here

function redhen_dedupe_option_label in RedHen CRM 7

Return an option label for the merge form.

Parameters

RedhenContact $contact: Contact entity.

string $property_name: Contact property name we need a label for.

array $property: Full property array.

Return value

string Label to use for an option field or other purpose.

1 call to redhen_dedupe_option_label()
redhen_dedupe_merge_form in modules/redhen_dedupe/includes/redhen_dedupe.form.inc
Form to select the master contact.

File

modules/redhen_dedupe/includes/redhen_dedupe.form.inc, line 331
Forms for creating, editing, and deleting contacts.

Code

function redhen_dedupe_option_label(RedhenContact $contact, $property_name, $property) {
  if (isset($property['field'])) {
    $field_array = field_view_field('redhen_contact', $contact, $property_name, array(
      'label' => 'hidden',
    ));
    $display = render($field_array);
  }
  else {
    $built_contact = $contact
      ->buildContent();
    if (isset($built_contact[$property_name])) {
      $display = render($built_contact[$property_name]);
    }
    else {
      $display = isset($contact->{$property_name}) ? $contact->{$property_name} : '';
    }
  }
  return !empty($display) ? $display : t('No value');
}