You are here

public static function Messaging_Destination::build_method in Messaging 7

Build from method, address, user

File

./messaging.destination.inc, line 127
Drupal Messaging Framework - Default class file

Class

Messaging_Destination
Message destination class

Code

public static function build_method($method, $address = NULL, $account = NULL) {
  $type = messaging_send_method($method)
    ->address_type();
  $uid = $account ? $account->uid : 0;
  if ($type && $address) {
    return self::build($type, $address, $uid);
  }
  elseif ($type && $account) {
    return self::build_user($type, $account);
  }
  elseif ($account) {
    return messaging_send_method($method)
      ->user_destination($account);
  }
}