You are here

function simplenews_get_recipient_handler in Simplenews 8

Same name and namespace in other branches
  1. 7.2 simplenews.module \simplenews_get_recipient_handler()

Build a recipient handler class from a given plugin id and settings array.

Parameters

$handler: The id of the simplenews_recipient_handler plugin to use.

$configuration: An array of settings to pass to the handler class.

Return value

\Drupal\simplenews\RecipientHandler\RecipientHandlerInterface A constructed recipient handler plugin.

Throws

Exception if the handler class does not exist.

1 call to simplenews_get_recipient_handler()
SpoolStorage::addFromEntity in src/Spool/SpoolStorage.php
Add the newsletter node to the mail spool.

File

./simplenews.module, line 720
Simplenews node handling, sent email, newsletter block and general hooks

Code

function simplenews_get_recipient_handler($newsletter, $handler, $configuration = array()) {
  $configuration['newsletter'] = $newsletter;
  return \Drupal::service('plugin.manager.simplenews_recipient_handler')
    ->createInstance($handler, $configuration);
}