You are here

protected function ContactEmailListBuilder::recipientFieldValue in Contact Emails 8

Get the description of recipient field value.

Parameters

\Drupal\contact_emails\Entity\ContactEmailInterface $entity: The email.

string $fieldName: The field name.

string $fieldType: The field type.

Return value

\Drupal\Core\StringTranslation\TranslatableMarkup The description of the field.

1 call to ContactEmailListBuilder::recipientFieldValue()
ContactEmailListBuilder::getRecipients in src/ContactEmailListBuilder.php
Gets the recipient text to display.

File

src/ContactEmailListBuilder.php, line 117

Class

ContactEmailListBuilder
Defines the list builder for tax services.

Namespace

Drupal\contact_emails

Code

protected function recipientFieldValue(ContactEmailInterface $entity, $fieldName, $fieldType) {

  /** @var \Drupal\contact_emails\ContactEmails $contactEmails */
  $contactEmails = \Drupal::service('contact_emails.helper');
  $contactFormId = $entity
    ->get('contact_form')->target_id;
  $fields = $contactEmails
    ->getContactFormFields($contactFormId, $fieldType);
  $field_label = $entity
    ->hasField($fieldName) && !$entity
    ->get($fieldName)
    ->isEmpty() && isset($fields[$entity
    ->get($fieldName)->value]) ? $entity
    ->get($fieldName)->value : $this
    ->t('*Unknown or deleted field*');
  return $this
    ->t('[The value of the "@field" field]', [
    '@field' => $field_label,
  ]);
}