|
<?php |
|
|
|
function XXX_node_view($node, $view_mode, $langcode) { |
|
if ($view_mode == 'full' && in_array($node->type, array('blog', 'release', 'report', 'review', 'story'))) { |
|
|
|
// http://dev.twitter.com/pages/tweet_button |
|
$links['twitter'] = array( |
|
'title' => t('Tweet'), |
|
'href' => 'http://twitter.com/share', |
|
'attributes' => array( |
|
'class' => 'twitter-share-button', |
|
), |
|
'query' => array( |
|
'url' => url($node->uri['path'], array('absolute' => TRUE)), |
|
'via' => 'XXX', |
|
'text' => $node->title, |
|
'counturl' => url($node->uri['path'], array('absolute' => TRUE, 'alias' => TRUE)), |
|
), |
|
); |
|
$script = <<<EOT |
|
window.fbAsyncInit = function() { |
|
FB.init({appId: 'XXX', status: true, cookie: true, |
|
xfbml: true}); |
|
}; |
|
(function() { |
|
var e = document.createElement('script'); e.async = true; |
|
e.src = document.location.protocol + |
|
'//connect.facebook.net/en_US/all.js'; |
|
document.getElementById('fb-root').appendChild(e); |
|
}()); |
|
EOT; |
|
drupal_add_js($script, array('type' => 'inline', 'scope' => 'footer')); |
|
$links['facebook'] = array( |
|
'title' => '<script src="http://connect.facebook.net/en_US/all.js#xfbml=1"></script><fb:like layout="button_count" show_faces="false" width="90" action="recommend" font="verdana"></fb:like>', |
|
'html' => TRUE, |
|
'query' => array( |
|
'url' => url($node->uri['path'], array('absolute' => TRUE)), |
|
'via' => 'intifada', |
|
'text' => $node->title, |
|
'counturl' => url($node->uri['path'], array('absolute' => TRUE, 'alias' => TRUE)), |
|
), |
|
); |
|
$node->content['links']['sharing'] = array( |
|
'#theme' => 'links__node__sharing', |
|
'#links' => $links, |
|
'#attributes' => array('class' => array('links', 'inline')), |
|
); |
|
$node->content['links']['#attached']['js']['http://platform.twitter.com/widgets.js'] = array( |
|
'type' => 'external', |
|
); |
|
} |
|
} |