You are here

function Notifications_Template::build in Notifications 6.3

Build notifications message

Overrides Messaging_Template::build

File

classes/notifications_template.class.inc, line 44
Notification Template classes

Class

Notifications_Template
Notifications Template

Code

function build($method = NULL, $language = NULL) {

  // If building for the first time give a chance to modules for altering this
  if (!$this->built) {
    drupal_alter('notifications_template', $this);
    $this->built = TRUE;
  }
  $method = $method ? $method : $this->method;
  $language = $language ? $language : $this
    ->get_language();
  $build = array(
    'template' => $this,
    'method' => $method,
    'language' => $language->language,
    'test' => $this->test,
  );
  $message = new Notifications_Message($build);
  $message
    ->set_sender($this->sender, $this->sender_option);
  $message
    ->set_user($this->user, $this->destination);
  if (isset($this->subscriptions)) {
    $message->notifications['subscriptions'] = $this->subscriptions;
  }
  if (isset($this->events)) {
    $message->notifications['events'] = $this->events;
  }
  return $message;
}