You are here

function Messaging_Send_Method::send_multiple in Messaging 6.3

Same name and namespace in other branches
  1. 7 messaging.method.inc \Messaging_Send_Method::send_multiple()

Send a message to multiple destinations

Parameters

$source: Message or message template

$destinations: Array of destinations for this method

File

classes/messaging_method.class.inc, line 51
Drupal Messaging Framework - Send_Method class file

Class

Messaging_Send_Method
Sending method, implements all specific method functionality

Code

function send_multiple($source, $destinations) {
  $result = array();
  $template = $source
    ->build($this->method, NULL);
  $template->destinations = $destinations;
  $template
    ->prepare();
  $template
    ->render();
  foreach ($destinations as $index => $destination) {
    $message = clone $template;
    $message->destination = $destination;
    $result[$index] = $message
      ->send();
  }
  return $result;
}