Index: twitter.module =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/twitter/twitter.module,v retrieving revision 1.3.2.12 diff -u -p -r1.3.2.12 twitter.module --- twitter.module 9 Apr 2009 14:34:26 -0000 1.3.2.12 +++ twitter.module 17 Apr 2009 03:27:58 -0000 @@ -96,10 +96,22 @@ function twitter_form_alter(&$form, $for ); $form['twitter'] += $twitter_form; $form['twitter']['status']['#default_value'] = variable_get('twitter_default_format', 'New post: !title !tinyurl'); - $form['twitter']['status']['#description'] = t('The given text will be posted to twitter.com. You can use !url, !url-alias, !tinyurl, !title and !user as replacement text.'); + $form['twitter']['status']['#description'] = t('The given text will be posted to twitter.com. You can use !url, !url-alias, !tinyurl, !title, !type, !terms and !user as replacement text.'); } } +/* + * Get taxonomy terms for this node, to pass as string of hash tags. + */ +function twitter_get_node_term_list($node) { + $taxonomy_array = array(); + $terms = taxonomy_node_get_terms($node); + foreach($terms as $tid => $term) { + $taxonomy_array[] = "#{$term->name}"; + } + return implode(' ', $taxonomy_array); +} + /** * Implementation of hook_nodeapi(). * @@ -118,6 +130,8 @@ function twitter_nodeapi(&$node, $op, $a $replacements = array('!title' => $node->title, '!url' => url('node/'. $node->nid, array('absolute' => TRUE, 'alias' => TRUE)), '!url-alias' => url('node/'. $node->nid, array('absolute' => TRUE)), + '!type' => node_get_types('name', $node, FALSE), + '!terms' => twitter_get_node_term_list($node), '!user' => $node->name); // Only generate the shortened URL if it's going to be used. No sense // burning through TinyURLs without a good reason.