Example: Token API in Examples for Developers 7
Same name and namespace in other branches
- 6 token_example/token_example.module \token_example
Examples using the Token API.
The Token module provides an API for providing tokens to other modules. Tokens are small bits of text that can be placed into larger documents via simple placeholders, like %site-name or [user].
Drupal 7 documentation on Token can be found here: http://drupal.org/documentation/modules/token
A list of existing tokens can be found here: http://drupal.org/node/390482#drupal7tokenslist
This example is part of the Examples for Developers Project which you can download and experiment with here: http://drupal.org/project/examples
Parent topics
File
- token_example/
token_example.module, line 12 - An example module showing how to define and use tokens.
Functions
Name | Location | Description |
---|---|---|
token_example_entity_info_alter |
token_example/ |
Implements hook_entity_info_alter(). |
token_example_example_form |
token_example/ |
Form builder; display lists of supported token entities and text to tokenize. |
token_example_example_form_submit |
token_example/ |
Submit callback; store the submitted values into storage. |
token_example_menu |
token_example/ |
Implements hook_menu(). |
token_example_tokens |
token_example/ |
Implements hook_tokens(). |
token_example_token_info |
token_example/ |
Implements hook_token_info(). |
_token_example_get_comment |
token_example/ |
Builds a list of available comments. |
_token_example_get_file |
token_example/ |
Builds a list of available files. |
_token_example_get_node |
token_example/ |
Builds a list of available content. |
_token_example_get_taxonomy_term |
token_example/ |
Builds a list of available taxonomy terms. |
_token_example_get_user |
token_example/ |
Builds a list of available user accounts. |
Classes
Name | Location | Description |
---|---|---|
TokenExampleTestCase |
token_example/ |
Functional tests for the Token Example module. |