public function SpoolStorage::deleteIssue in Simplenews 3.x
Same name and namespace in other branches
- 8.2 src/Spool/SpoolStorage.php \Drupal\simplenews\Spool\SpoolStorage::deleteIssue()
Deletes a newsletter issue from the mail spool.
Parameters
\Drupal\Core\Entity\ContentEntityInterface $issue: The newsletter issue to be deleted.
Overrides SpoolStorageInterface::deleteIssue
File
- src/
Spool/ SpoolStorage.php, line 269
Class
- SpoolStorage
- Default database spool storage.
Namespace
Drupal\simplenews\SpoolCode
public function deleteIssue(ContentEntityInterface $issue) {
if ($issue->simplenews_issue->status != SIMPLENEWS_STATUS_SEND_PENDING) {
return;
}
$count = $this
->deleteMails([
'entity_type' => $issue
->getEntityTypeId(),
'entity_id' => $issue
->id(),
]);
$issue->simplenews_issue->status = SIMPLENEWS_STATUS_SEND_NOT;
$issue
->save();
$this
->messenger()
->addMessage($this
->t('Sending of %title was stopped. @count pending email(s) were deleted.', [
'%title' => $issue
->getTitle(),
'@count' => $count,
]));
}