You are here

function notifications_content_node_links in Notifications 7

Attach subscription links to the node object.

1 call to notifications_content_node_links()
notifications_content_node_view in notifications_content/notifications_content.module
Implements hook_node_view().

File

notifications_content/notifications_content.module, line 212
Subscriptions to content events

Code

function notifications_content_node_links($node, $display_option, $account = NULL) {
  $account = $account == NULL ? $GLOBALS['user'] : $account;
  $notifications_node = array(
    notifications_object('node', $node),
  );
  $subscription_list = Notifications_Subscription::object_subscriptions($notifications_node, $account)
    ->set_user($account)
    ->filter_option($display_option)
    ->get_instances();
  foreach ($subscription_list as $key => $subscription) {
    $link = $subscription
      ->element_link('subscription');
    $item = array(
      'title' => $link['#title'],
      'href' => $link['#href'],
    ) + $link['#options'];
    $node->content['links']['notifications_content']['#links']['notifications-' . $key] = $item;
  }
}