public static function Messaging_Destination::create_type in Messaging 7
Same name and namespace in other branches
- 6.4 includes/messaging_destination.class.inc \Messaging_Destination::create_type()
Create with parameters
2 calls to Messaging_Destination::create_type()
- Messaging_Destination::create in ./
messaging.destination.inc - Create from array data
- Messaging_Destination::create_method in ./
messaging.destination.inc - Create for sending method
File
- ./
messaging.destination.inc, line 267 - Drupal Messaging Framework - Default class file
Class
- Messaging_Destination
- Message destination class
Code
public static function create_type($type, $address, $uid) {
if ($existing = self::get_by_address($type, $address)) {
if ($existing->uid != $uid) {
$existing->uid = $uid;
$existing
->save();
}
return $existing;
}
elseif ($uid && ($existing = self::get(array(
'uid' => $uid,
'type' => $type,
'address' => '',
)))) {
$existing->address = $address;
$existing
->save();
return $existing;
}
else {
$destination = self::build(array(
'type' => $type,
'address' => $address,
'uid' => $uid,
));
$destination
->save();
return $destination;
}
}