You are here

function Notifications_Subscription::build_link in Notifications 6.4

Build subscribe /unsubscribe link

File

includes/notifications_subscription.class.inc, line 233
Drupal Notifications Framework - Default class file

Class

Notifications_Subscription
Message destination class

Code

function build_link($options = array()) {
  if ($this
    ->is_instance()) {

    // Unsubscribe link
    $title = t('Unsubscribe from: @name', array(
      '@name' => $this
        ->get_name(),
    ));
    $options += array(
      'sid' => $this->sid,
    );
    $props = notifications_subscription_get_link('unsubscribe', $this, $options);
  }
  else {

    // Subscribe link
    $title = t('Subscribe to: @name', array(
      '@name' => $this
        ->get_name(),
    ));
    $options += array(
      'type' => $this->type,
      'fields' => $this
        ->get_conditions(),
    );
    $props = notifications_subscription_get_link('subscribe', $this, $options);
  }
  return $props ? array(
    'title' => $title,
    'html' => TRUE,
    'href' => $props['href'],
  ) + $props['options'] : NULL;
}