You are here

function simplenews_get_recipient_handler in Simplenews 7.2

Same name and namespace in other branches
  1. 8 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.

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

Return value

SimplenewsRecipientHandlerInterface A constructed SimplenewsRecipientHandler class.

Throws

Exception if the handler class does not exist.

1 call to simplenews_get_recipient_handler()
simplenews_add_node_to_spool in includes/simplenews.mail.inc
Add the newsletter node to the mail spool.

File

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

Code

function simplenews_get_recipient_handler($newsletter, $handler, $settings = array()) {
  ctools_include('plugins');
  $handler = ctools_get_plugins('simplenews', 'recipient_handlers', $handler);
  $class = $handler['class'];
  if (!class_exists($class)) {
    throw new Exception(t('Recipient Handler Class @class does not exist.', array(
      '@class' => $class,
    )));
  }
  return new $class($newsletter, $handler, $settings);
}