You are here

function feedapi_node_link in FeedAPI 5

Same name and namespace in other branches
  1. 6 feedapi_node/feedapi_node.module \feedapi_node_link()

Implementation of hook_link().

File

feedapi_node/feedapi_node.module, line 79
Handle how the feed items are represented as a content Handle the processing of the feed items

Code

function feedapi_node_link($type, $node = NULL) {
  if ($type == 'node') {
    if ($node->feedapi_node) {
      $result = db_query("SELECT n.title, n.nid FROM {node} n WHERE n.nid IN (%s) ORDER BY title DESC", implode(', ', $node->feedapi_node->feed_nids));
      $owner_feeds_num = db_num_rows($result);
      while ($feed = db_fetch_object($result)) {
        $links['feedapi_feed' . ($owner_feeds_num == 1 ? '' : '_' . $feed->nid)] = array(
          'title' => t('Feed:') . ' ' . $feed->title,
          'href' => 'node/' . $feed->nid,
        );
      }
      if ($node->feedapi_node->url) {
        $links['feedapi_original'] = array(
          'title' => t('Original article'),
          'href' => $node->feedapi_node->url,
        );
      }
      return $links;
    }
  }
}