function notifications_token_values in Notifications 6.2
Same name and namespace in other branches
- 5 notifications.module \notifications_token_values()
- 6.4 notifications.module \notifications_token_values()
- 6 notifications.module \notifications_token_values()
- 6.3 notifications.module \notifications_token_values()
Implementation of hook_token_values()
@ TODO: Work out event tokens
File
- ./
notifications.module, line 1208 - Notifications module
Code
function notifications_token_values($type, $object = NULL, $options = array()) {
switch ($type) {
case 'subscription':
$values = array();
if ($subscription = $object) {
$link = notifications_get_link('unsubscribe', array(
'sid' => $subscription->sid,
'signed' => TRUE,
'absolute' => TRUE,
));
$values['unsubscribe-url'] = url($link['href'], $link['options']);
}
return $values;
case 'user':
$values = array();
if (($account = $object) && !empty($object->uid)) {
// We have a real user, so we produce full links
$values['subscriptions-manage'] = url("user/{$account->uid}/notifications", array(
'absolute' => TRUE,
));
$link = notifications_get_link('unsubscribe', array(
'uid' => $account->uid,
'signed' => TRUE,
'absolute' => TRUE,
));
$values['unsubscribe-url-global'] = url($link['href'], $link['options']);
}
return $values;
}
}