You are here

public function EasyEmail::removeEvaluatedAttachment in Easy Email 8

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

@inheritDoc

Overrides EasyEmailInterface::removeEvaluatedAttachment

File

src/Entity/EasyEmail.php, line 780

Class

EasyEmail
Defines the Email entity.

Namespace

Drupal\easy_email\Entity

Code

public function removeEvaluatedAttachment($attachment) {
  $existing_attachments = $this
    ->getEvaluatedAttachments();
  foreach ($existing_attachments as $i => $existing_attachment) {
    if ($existing_attachment->uri === $attachment->uri) {
      unset($existing_attachments[$i]);
    }
  }
  $this->evaluatedAttachments = array_values($existing_attachments);
  return $this;
}