You are here

protected function RecipientHandlerBase::getNewsletterId in Simplenews 8.2

Same name and namespace in other branches
  1. 3.x src/Plugin/simplenews/RecipientHandler/RecipientHandlerBase.php \Drupal\simplenews\Plugin\simplenews\RecipientHandler\RecipientHandlerBase::getNewsletterId()

Returns the newsletter ID.

Return value

int Newsletter ID.

Throws

\Exception The configuration doesn't specify a single newsletter ID.

2 calls to RecipientHandlerBase::getNewsletterId()
RecipientHandlerAll::buildRecipientQuery in src/Plugin/simplenews/RecipientHandler/RecipientHandlerAll.php
Build the query that gets the list of recipients.
RecipientHandlerBase::addArrayToSpool in src/Plugin/simplenews/RecipientHandler/RecipientHandlerBase.php
Adds an array of entries to the spool.

File

src/Plugin/simplenews/RecipientHandler/RecipientHandlerBase.php, line 109

Class

RecipientHandlerBase
Base class for all Recipient Handler classes.

Namespace

Drupal\simplenews\Plugin\simplenews\RecipientHandler

Code

protected function getNewsletterId() {
  if (count($this->newsletterIds) != 1) {
    throw new \Exception("Recipient handler requires a single newsletter ID.");
  }
  return $this->newsletterIds[0];
}