You are here

public function CourierManagerInterface::sendMessage in Courier 2.x

Same name and namespace in other branches
  1. 8 src/Service/CourierManagerInterface.php \Drupal\courier\Service\CourierManagerInterface::sendMessage()

Prepares messages for an identity and and queues them for transmission.

Once this method is executed, responsibility for transmission is passed to Courier.

$options = [
  'my_option' => 123,
  'channels' => [
    'courier_email' => [
      'foo' => 456,
    ],
    'sms' => [
      'bar' => 679,
    ],
  ],
];

// Will transform options into this array when sending to courier_email:
$options = [
  'my_option' => 123,
  'foo' => 456,
];

Parameters

\Drupal\courier\TemplateCollectionInterface $template_collection: A template collection entity.

\Drupal\Core\Entity\EntityInterface $identity: An identity entity.

array $options: Optional options to pass to the channel. If the 'channels' key is specified, this will find a sub array with the key of the channel being transmitted to, and merge it into the base base array. The channels key will then be unset. e.g: Sending to the courier_email channel:

Return value

\Drupal\courier\MessageQueueItemInterface|false A message queue item entity, or FALSE if no messages could be generated.

1 method overrides CourierManagerInterface::sendMessage()
CourierManager::sendMessage in src/Service/CourierManager.php
Prepares messages for an identity and and queues them for transmission.

File

src/Service/CourierManagerInterface.php, line 59

Class

CourierManagerInterface
Interface for Courier manager.

Namespace

Drupal\courier\Service

Code

public function sendMessage(TemplateCollectionInterface $template_collection, EntityInterface $identity, array $options = []);