Hi, thanks a lot for your module (you may want to add ejournal.module into into your list)
I was wondering if you could add support for token_replace for all the types - because, I cannot query the available types of objects, it seems to me to be overhead to use tokens_find_all, I would like to just call your function like "token_replace($string, "alltypes")
roman
Comments
Comment #1
gregglesI think that token_replace($string, 'all') should do that. In practice, it doesn't do it all of the time...it depends on the individual hook_token_values implementation as to whether or not that will work. If a module doesn't respect the 'all' then there should be a bug filed against the specific module.
Since the token module doesn't respond to that properly I'd like to turn this into a bug against token...
Comment #2
avpadernoI find quite difficult to pass
'all'to the implementation ofhook_token_values(). Which would be the value assigned to$objectin that case?Then, there is already the
token_replace_multiple()function. What is the purpose of havingtoken_replace()that passes'all'tohook_token_values()?Comment #3
dave reidThis isn't a good idea. If you need to you can run the token functions more than once. :)
Comment #4
Equinger commentedI'm going to weigh in on this a year later! Basically, the reason for this feature is that contributed modules like "Messaging" can call "token_replace_multiple" which implicitly defines related objects for an event like sending out a notification, but there is no way to build a token that takes into account the interaction between objects. For example, right now I can only deal with "node," "user," "comment," and "event." The user is actually the user who is being sent the notification and the node is the node that he/she is being sent a notification about. The user clearly has a special relationship w/ that node (aka ... how many comments are NEW to that user on the node). It's a good possibility that I don't have enough imagination (or done enough research) on other ways to resolve this issue, but this would seem like the lowest hanging fruit.