You are here

function notifications_get_link in Notifications 6.4

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

Return link array for subscriptions. OBSOLETED.

This one is kept just for backwards compatibility. Use notifications_build_link() instead.

Parameters

$type: Object type: 'subscribe', 'unsubscribe'

$params: Aditional parameters for the subscription, may be

  • uid, the user for which the link is generated
  • confirm, whether to show confirmation page or not
  • destination, form destination or TRUE to use current path
  • signed, to produce a signed link that can be used by anonymous users (Example: unsubscribe link in emails)
  • type, object type
  • language, language object to get the url
  • Other subscription parameters: type, fields...

$format: Whether to return a formatted link instead of a raw one (array)

3 calls to notifications_get_link()
NotificationsContentTests::testNotificationsContent in tests/notifications_content.test
Play with creating, retrieving, deleting a pair subscriptions
NotificationsTestCase::contentCreateSubscription in tests/notifications_test_case.inc
Helper function to create a subscription
notifications_user_overview in ./notifications.pages.inc
Menu callback. Overview page for user subscriptions.

File

./notifications.module, line 1424
Notifications module

Code

function notifications_get_link($op, $params, $format = FALSE) {

  // Add some default values
  $params += array(
    'uid' => 0,
  );
  $elements = array();
  switch ($op) {
    case 'subscribe':
      $type = 'subscription';
      break;
    case 'unsubscribe':

      // The unsubscribe link can be for a single subscription or all subscriptions for a user
      if (!empty($params['sid'])) {
        $type = 'subscription';
        $params['oid'] = $params['sid'];
      }
      elseif ($params['uid']) {
        $type = 'user';
        $params['oid'] = $params['uid'];
      }
      break;
    case 'edit':

      // Edit subscription
      $type = 'subscription';
      $params['oid'] = $params['sid'];
      break;
  }
  return notifications_build_link($op, $params, $type, NULL, $format ? 'link' : 'array');
}