You are here

public static function Messaging_Simple::build in Messaging 7

Build from user account and Messaging_Message

1 call to Messaging_Simple::build()
Messaging_Simple_Method::send_user in messaging_simple/messaging_simple.inc
Send to user. Just store the message to be shown later.

File

messaging_simple/messaging_simple.inc, line 30
Drupal Messaging Framework - Send_Method class file

Class

Messaging_Simple
Simple message instance

Code

public static function build($user, $message) {
  $store = new Messaging_Simple();
  $store->uid = $user->uid;
  $store->msid = $message->msid;
  $store->sender = $message
    ->get_sender('uid');
  $store->language = $message
    ->get_language()->language;

  // Build message subject and content, may do token replacement
  $template = $message
    ->get_template();

  // As this is to be displayed on site we don't need greetings nor footer
  $store->subject = $template
    ->render('subject');
  $store->body = $template
    ->render('content');
  return $store;
}