Simple Twitter Anywhere Drupal integration
Submitted by timmillwood on Thu, 04/15/2010 - 14:48
Yesterday Twitter announced their Anywhere API (http://dev.twitter.com/anywhere/begin). So I quickly added it to a custom module.
Here's how...
function module_name_init(){
drupal_set_html_head('');
$js = "twttr.anywhere(function(twitter) {";
$js .= "twitter.hovercards();";
$js .= "twitter.linkifyUsers();";
$js .= "});";
drupal_add_js($js, 'inline');
}
All you need to do is change 'module_name' to your module name and change 'YourTwitterAPIKey' to your Twitter API key.
Then all the @ names on your page will turn to Twitter links, and have Twitter hover cards.
