You are here

private function RedhenDedupeMergeForm::redhenDedupeOptionLabel in RedHen CRM 8

Return an option label for the merge form.

Parameters

Contact $contact: Contact entity.

string $field_name: Contact field name we need a label for.

array $field: Full field config.

Return value

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

1 call to RedhenDedupeMergeForm::redhenDedupeOptionLabel()
RedhenDedupeMergeForm::buildForm in modules/redhen_dedupe/src/Form/RedhenDedupeMergeForm.php
Form constructor.

File

modules/redhen_dedupe/src/Form/RedhenDedupeMergeForm.php, line 318

Class

RedhenDedupeMergeForm
Form controller for Dedupe merge tool.

Namespace

Drupal\redhen_dedupe\Form

Code

private function redhenDedupeOptionLabel(Contact $contact, $field_name) {
  $render = $contact
    ->get($field_name)
    ->view([
    'label' => 'hidden',
  ]);
  $display = \Drupal::service('renderer')
    ->render($render);
  return !$contact
    ->get($field_name)
    ->isEmpty() ? $display : $this
    ->t('No value');
}