function tweet_node_view in Tweet 7.4
Implements hook_node_view().
File
- ./
tweet.module, line 24 - Builds links to post pages to Twitter API sites.
Code
function tweet_node_view($node, $view_mode) {
$types = variable_get('tweet_types', _tweet_node_types());
if ((in_array($node->type, $types) || empty($types)) && !_tweet_exclude($node->nid)) {
if ($view_mode == 'full') {
$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);
}
$node->content['links']['tweet'] = array(
'#theme' => 'links',
'#links' => $links,
'#attributes' => array(
'class' => array(
'links',
'inline',
),
),
);
}
}
}