Token integration for comment URL token

Owen Barton - March 3, 2009 - 01:27
Project:Talk
Version:6.x-1.x-dev
Component:Code
Category:feature request
Priority:normal
Assigned:Unassigned
Status:closed
Description

A little similar to the views patch I just posted, this one provides a new token so you can link to the correct URL for comments in e-mails (e.g. notification module new comment e-mails).

AttachmentSize
token.patch1.26 KB

#1

cwgordon7 - March 15, 2009 - 20:15

Why can't this be handled by just using [comment-node-url]/talk or something similar, without needing to add a new token?

#2

Owen Barton - March 15, 2009 - 23:10

Because some content types may have talk enabled, and some may not.

#3

cwgordon7 - March 16, 2009 - 02:31

Oh, tricky, nice. Isn't there a .token.inc file or something that we could put this code into that the token module will include automatically?

#4

greggles - June 30, 2009 - 21:15

Isn't there a .token.inc file or something

There is not. You just put it in your module.

#5

Todd Nienkerk - June 30, 2009 - 21:41

+1. Related token integration issue: #506658: Customizable titles everywhere using tokens.

#6

greggles - July 2, 2009 - 22:36
Version:5.x-1.3» 6.x-1.x-dev

Here is basically the same patch updated for the way url() works in 6.x.

You can test it by adding something like this to your hook_comment and then posting a comment:

    dsm(token_replace('monkey [comment-talk-url]', 'comment', $a1));

#7

greggles - July 2, 2009 - 22:37
AttachmentSize
389172_talk_token_6x_6.patch 1.42 KB

#8

cwgordon7 - July 11, 2009 - 19:24

Maybe it would make more sense to change the comment module's token rather than provide our own?

#9

greggles - July 12, 2009 - 00:34

There currently is not way for one module to modify another module's token set. Instead you have to provide your own (this is due to the way hook_token_values is designed and the way that Drupal's module_invoke_all merges arrays).

#10

greggles - July 14, 2009 - 17:01
Status:needs review» fixed

Committed to the 6.x branch. http://drupal.org/cvs?commit=237334

@Owen - thanks for your work on this. If you still want it for 5.x let me know and I'll see about committing there as well.

#11

System Message - July 28, 2009 - 17:10
Status:fixed» closed

Automatically closed -- issue fixed for 2 weeks with no activity.

 
 

Drupal is a registered trademark of Dries Buytaert.