QueueMessages.php in Mass Contact 8
File
src/Plugin/QueueWorker/QueueMessages.php
View source
<?php
namespace Drupal\mass_contact\Plugin\QueueWorker;
use Drupal\Core\Plugin\ContainerFactoryPluginInterface;
use Drupal\Core\Queue\QueueWorkerBase;
use Drupal\mass_contact\MassContactInterface;
use Symfony\Component\DependencyInjection\ContainerInterface;
class QueueMessages extends QueueWorkerBase implements ContainerFactoryPluginInterface {
protected $massContact;
public function __construct(array $configuration, $plugin_id, $plugin_definition, MassContactInterface $mass_contact) {
parent::__construct($configuration, $plugin_id, $plugin_definition);
$this->massContact = $mass_contact;
}
public static function create(ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition) {
return new static($configuration, $plugin_id, $plugin_definition, $container
->get('mass_contact'));
}
public function processItem($data) {
$this->massContact
->queueRecipients($data['message'], $data['configuration']);
}
}