class SendMessage in Mass Contact 8
Sends a mass contact message to a given user.
Plugin annotation
@QueueWorker(
id = "mass_contact_send_message",
title = @Translation("Sends a mass contact message to an individual recipient")
)
Hierarchy
- class \Drupal\Component\Plugin\PluginBase implements DerivativeInspectionInterface, PluginInspectionInterface
- class \Drupal\Core\Queue\QueueWorkerBase implements QueueWorkerInterface
- class \Drupal\mass_contact\Plugin\QueueWorker\SendMessage implements ContainerFactoryPluginInterface
- class \Drupal\Core\Queue\QueueWorkerBase implements QueueWorkerInterface
Expanded class hierarchy of SendMessage
See also
\Drupal\mass_contact\Plugin\QueueWorker\QueueMessages
File
- src/
Plugin/ QueueWorker/ SendMessage.php, line 20
Namespace
Drupal\mass_contact\Plugin\QueueWorkerView source
class SendMessage extends QueueWorkerBase implements ContainerFactoryPluginInterface {
/**
* The mass contact helper service.
*
* @var \Drupal\mass_contact\MassContactInterface
*/
protected $massContact;
/**
* Queue worker constructor.
*
* @param array $configuration
* The plugin configuration.
* @param string $plugin_id
* The plugin ID.
* @param mixed $plugin_definition
* The plugin definition.
* @param \Drupal\mass_contact\MassContactInterface $mass_contact
* The mass contact helper service.
*/
public function __construct(array $configuration, $plugin_id, $plugin_definition, MassContactInterface $mass_contact) {
parent::__construct($configuration, $plugin_id, $plugin_definition);
$this->massContact = $mass_contact;
}
/**
* {@inheritdoc}
*/
public static function create(ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition) {
return new static($configuration, $plugin_id, $plugin_definition, $container
->get('mass_contact'));
}
/**
* {@inheritdoc}
*/
public function processItem($data) {
$this->massContact
->sendMessage($data['recipients'], $data['message'], $data['configuration']);
}
}
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. | |
SendMessage:: |
protected | property | The mass contact helper service. | |
SendMessage:: |
public static | function |
Creates an instance of the plugin. Overrides ContainerFactoryPluginInterface:: |
|
SendMessage:: |
public | function |
Works on a single queue item. Overrides QueueWorkerInterface:: |
|
SendMessage:: |
public | function |
Queue worker constructor. Overrides PluginBase:: |