Closed (fixed)
Project:
Token
Version:
6.x-1.12
Component:
Code
Priority:
Normal
Category:
Support request
Assigned:
Unassigned
Reporter:
Created:
30 Sep 2009 at 15:37 UTC
Updated:
21 Mar 2010 at 03:40 UTC
I have been reading the forums and documentation.
I am creating a custom lead generation module / block / form
I would like to be able to use some tokens like node author's name and email address but I do not see how to call these up in my module.
Comments
Comment #1
MGN commentedFrom my experience, the best way to learn is to have a look at other modules that use the token api and then adapt to your own needs. So check out the list of modules that use the token module and start reading through the code to find anything that refers to tokens.
I'll give one example from custom_breadcrumbs. To replace tokens used in breadcrumb titles and paths, determine the types of tokens (nodes, taxonomy, user, global) that can be replaced replacement, and then call token_replace_multiple(). As the name implies, this function replaces the tokens in the $titles and $path text string.
I hope this gives an idea of how to do it. There are more details that you'll get from carefully reading the code in its proper context.
Comment #2
dave reidAlso see the API.txt included with the token module.