You are here

function tweet_link in Tweet 6.4

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

Implementation of hook_link().

File

./tweet.module, line 25
Builds links to post pages to Twitter API sites.

Code

function tweet_link($type, $node = NULL, $teaser = FALSE) {
  $types = variable_get('tweet_types', _tweet_node_types());
  if ($type == 'node' && (in_array($node->type, $types) || empty($types)) && !_tweet_exclude($node->nid)) {
    $title = variable_get('tweet_title', 1);
    if (!$teaser) {
      $link_type = variable_get('tweet_node', 'icon');
    }
    else {
      $link_type = variable_get('tweet_teaser', 'none');
    }
    if ($link_type != 'none') {
      $links = array();
      foreach (tweet_sites(TRUE) as $site => $info) {
        $links['tweet_' . $site] = _tweet_to_twitter($site, $link_type, '', $node->nid);
      }
      return $links;
    }
  }
}