You are here

RecipientHandlerSiteMail.php in Simplenews 8.2

File

modules/simplenews_demo/src/Plugin/simplenews/RecipientHandler/RecipientHandlerSiteMail.php
View source
<?php

namespace Drupal\simplenews_demo\Plugin\simplenews\RecipientHandler;

use Drupal\simplenews\Plugin\simplenews\RecipientHandler\RecipientHandlerBase;

/**
 * Recipient Handler that sends to the main site mail.
 *
 * @RecipientHandler(
 *   id = "simplenews_site_mail",
 *   title = @Translation("Send to main site mail")
 * )
 */
class RecipientHandlerSiteMail extends RecipientHandlerBase {

  /**
   * {@inheritdoc}
   */
  public function addToSpool() {
    $subscriber_data = [
      'mail' => \Drupal::config('system.site')
        ->get('mail'),
    ];
    $this
      ->addArrayToSpool('data', [
      $subscriber_data,
    ]);
    return 1;
  }

  /**
   * {@inheritdoc}
   */
  protected function doCount() {
    return 1;
  }

}

Classes

Namesort descending Description
RecipientHandlerSiteMail Recipient Handler that sends to the main site mail.