? 389172_talk_token_6x_6.patch
? token_11.patch
Index: talk.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/talk/talk.module,v
retrieving revision 1.6.2.5
diff -u -p -b -B -w -r1.6.2.5 talk.module
--- talk.module	3 May 2009 19:39:17 -0000	1.6.2.5
+++ talk.module	2 Jul 2009 22:35:58 -0000
@@ -199,3 +199,35 @@ function template_preprocess_talkpage(&$
   $variables['comment_link'] = $comment_link;
   $variables['comments'] = $comments;
 }
\ No newline at end of file
+
+/**
+ * Implementation of hook_token_list(). Documents the individual
+ * tokens handled by the module.
+ */
+function talk_token_list($type = 'all') {
+  $tokens = array();
+  if ($type == 'comment' || $type == 'all') {
+    $tokens['comment']['comment-talk-url'] = t('The comment view url (Talk compatible).');
+  }
+  return $tokens;
+}
+
+/**
+ * Implementation of hook_token_values().
+ */
+function talk_token_values($type, $object = NULL, $options = array()) {
+  switch ($type) {
+    case 'comment':
+      if ($comment = (object)$object) {
+        $talk = '';
+        $node = node_load($comment->nid);
+        if (talk_activated($node->type)) {
+          $talk = '/talk';
+        }
+        $values['comment-talk-url'] = url('node/'. $comment->nid . $talk, array('fragment' => 'comment-'. $comment->cid, 'absolute' => TRUE));
+        return $values;
+      }
+      break;
+  }
+}
+
