You are here

function notifications_token_values in Notifications 5

Same name and namespace in other branches
  1. 6.4 notifications.module \notifications_token_values()
  2. 6 notifications.module \notifications_token_values()
  3. 6.2 notifications.module \notifications_token_values()
  4. 6.3 notifications.module \notifications_token_values()

Implementation of hook_token_values()

@ TODO: Work out event tokens

File

./notifications.module, line 822
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,
        ));
        $values['unsubscribe-url'] = url($link['href'], $link['query'], NULL, TRUE);
      }
      return $values;
    case 'user':
      if ($account = $object) {
        return array(
          'subscriptions-manage' => $account->uid ? url("user/{$account->uid}/notifications", NULL, NULL, TRUE) : '',
        );
      }
  }
}