function notifications_token_values in Notifications 6
Same name and namespace in other branches
- 5 notifications.module \notifications_token_values()
- 6.4 notifications.module \notifications_token_values()
- 6.2 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 1156 - 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,
'destination' => FALSE,
'absolute' => TRUE,
));
$values['unsubscribe-url'] = url($link['href'], $link['options']);
}
return $values;
case 'user':
if ($account = $object) {
$values['subscriptions-manage'] = $account->uid ? url("user/{$account->uid}/notifications", array(
'absolute' => TRUE,
)) : '';
$link = notifications_get_link('unsubscribe', array(
'uid' => $account->uid,
'signed' => TRUE,
'destination' => FALSE,
'absolute' => TRUE,
));
$values['unsubscribe-url-global'] = url($link['href'], $link['options']);
return $values;
}
}
}