You are here

function Notifications_Subscription::get_destination in Notifications 7

Same name and namespace in other branches
  1. 6.4 includes/notifications_subscription.class.inc \Notifications_Subscription::get_destination()

Get destination object.

Though a destination is just an address, in this case it will have a sending method too, so it can be passed on to the messaging layer with the full information.

File

./notifications.subscription.inc, line 1312
Drupal Notifications Framework - Default class file

Class

Notifications_Subscription
Common base for subscription type and subscription instance

Code

function get_destination() {
  if (!empty($this->mdid)) {

    // This is a stored destination, load and return
    return Messaging_Destination::load($this->mdid);
  }
  elseif ($this->uid && ($user = $this
    ->get_user())) {

    // We try to build a destination knowing the method and the user
    return Messaging_Destination::build_method($this->send_method, NULL, $user);
  }
  else {
    return NULL;
  }
}