You are here

protected function EasyEmail::addTextValueToList in Easy Email 8

Same name and namespace in other branches
  1. 2.0.x src/Entity/EasyEmail.php \Drupal\easy_email\Entity\EasyEmail::addTextValueToList()

Add an entity by ID to the an entity reference field item list.

Parameters

string $text:

string $field_name:

Return value

$this

4 calls to EasyEmail::addTextValueToList()
EasyEmail::addAttachmentPath in src/Entity/EasyEmail.php
@inheritDoc
EasyEmail::addBCCAddress in src/Entity/EasyEmail.php
@inheritDoc
EasyEmail::addCCAddress in src/Entity/EasyEmail.php
@inheritDoc
EasyEmail::addRecipientAddress in src/Entity/EasyEmail.php
@inheritDoc

File

src/Entity/EasyEmail.php, line 897

Class

EasyEmail
Defines the Email entity.

Namespace

Drupal\easy_email\Entity

Code

protected function addTextValueToList($text, $field_name) {
  $strings = $this
    ->getListTextValues($this
    ->get($field_name));
  if (!is_null($strings) && !in_array($text, $strings)) {
    $strings[] = $text;
    $this
      ->set($field_name, $strings);
  }
  return $this;
}