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).
| Attachment | Size |
|---|---|
| token.patch | 1.26 KB |

#1
Why can't this be handled by just using [comment-node-url]/talk or something similar, without needing to add a new token?
#2
Because some content types may have talk enabled, and some may not.
#3
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
There is not. You just put it in your module.
#5
+1. Related token integration issue: #506658: Customizable titles everywhere using tokens.
#6
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
#8
Maybe it would make more sense to change the comment module's token rather than provide our own?
#9
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
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
Automatically closed -- issue fixed for 2 weeks with no activity.