class SendGridQueue in SendGrid Integration 8
Same name and namespace in other branches
- 8.2 src/Plugin/QueueWorker/SendGridQueue.php \Drupal\sendgrid_integration\Plugin\QueueWorker\SendGridQueue
Sendgrid resend queue worker.
Plugin annotation
@QueueWorker(
id = "SendGridResendQueue",
title = @Translation("SendGrid Resend queue"),
cron = {"time" = 60}
)
Hierarchy
- class \Drupal\Component\Plugin\PluginBase implements DerivativeInspectionInterface, PluginInspectionInterface
- class \Drupal\Core\Queue\QueueWorkerBase implements QueueWorkerInterface
- class \Drupal\sendgrid_integration\Plugin\QueueWorker\SendGridQueue implements ContainerFactoryPluginInterface
- class \Drupal\Core\Queue\QueueWorkerBase implements QueueWorkerInterface
Expanded class hierarchy of SendGridQueue
File
- src/
Plugin/ QueueWorker/ SendGridQueue.php, line 19
Namespace
Drupal\sendgrid_integration\Plugin\QueueWorkerView source
class SendGridQueue extends QueueWorkerBase implements ContainerFactoryPluginInterface {
/**
* The mail manager service.
*
* @var \Drupal\Core\Mail\MailManagerInterface
*/
protected $mailManager;
/**
* SendgridQueue constructor.
*
* @param array $configuration
* A configuration array containing information about the plugin instance.
* @param string $plugin_id
* The plugin_id for the plugin instance.
* @param mixed $plugin_definition
* The plugin implementation definition.
* @param \Drupal\Core\Mail\MailManagerInterface $mailManager
* THe mail manager service.
*/
public function __construct(array $configuration, $plugin_id, $plugin_definition, MailManagerInterface $mailManager) {
$this->mailManager = $mailManager;
parent::__construct($configuration, $plugin_id, $plugin_definition);
}
/**
* {@inheritdoc}
*/
public static function create(ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition) {
return new static($configuration, $plugin_id, $plugin_definition, $container
->get('plugin.manager.mail'));
}
/**
* {@inheritdoc}
*/
public function processItem($message) {
// Defining parameters first to improve code readability.
$module = $message['module'];
$key = $message['key'];
$to = $message['to'];
$language = $message['language'];
$params = $message['params'];
$from = $message['from'];
$send = $message['send'];
$this->mailManager
->mail($module, $key, $to, $language, $params, $from, $send);
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
PluginBase:: |
protected | property | Configuration information passed into the plugin. | 1 |
PluginBase:: |
protected | property | The plugin implementation definition. | 1 |
PluginBase:: |
protected | property | The plugin_id. | |
PluginBase:: |
constant | A string which is used to separate base plugin IDs from the derivative ID. | ||
PluginBase:: |
public | function |
Gets the base_plugin_id of the plugin instance. Overrides DerivativeInspectionInterface:: |
|
PluginBase:: |
public | function |
Gets the derivative_id of the plugin instance. Overrides DerivativeInspectionInterface:: |
|
PluginBase:: |
public | function |
Gets the definition of the plugin implementation. Overrides PluginInspectionInterface:: |
3 |
PluginBase:: |
public | function |
Gets the plugin_id of the plugin instance. Overrides PluginInspectionInterface:: |
|
PluginBase:: |
public | function | Determines if the plugin is configurable. | |
SendGridQueue:: |
protected | property | The mail manager service. | |
SendGridQueue:: |
public static | function |
Creates an instance of the plugin. Overrides ContainerFactoryPluginInterface:: |
|
SendGridQueue:: |
public | function |
Works on a single queue item. Overrides QueueWorkerInterface:: |
|
SendGridQueue:: |
public | function |
SendgridQueue constructor. Overrides PluginBase:: |