Hi, I'm Tim Millwood. I am a Web Developer from Abergavenny, UK, and work for Mark Boulton Design, specializing in Drupal. This is my blog!
Simple Twitter Anywhere Drupal integration
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('<script src="http://platform.twitter.com/anywhere.js?id=YourTwitterAPIKey&v=1" type="text/javascript"></script>');
$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.










