This example demonstrates how to use the token API.
Tokens are small bits of text that can be placed into larger documents via simple placeholders, like %site-name or [user].
This example is part of the Examples for Developers project.
Parent topics
File
- modules/
examples/ token_example/ token_example.module, line 7 - Hook implementations for the Token Example module.
Functions
Name | Location | Description |
---|---|---|
token_example_entity_info_alter |
modules/ |
Implements hook_entity_info_alter(). |
token_example_example_form |
modules/ |
Form builder; display lists of supported token entities and text to tokenize. |
token_example_example_form_submit |
modules/ |
Submit callback; store the submitted values into storage. |
token_example_menu |
modules/ |
Implements hook_menu(). |
token_example_tokens |
modules/ |
Implements hook_tokens(). |
token_example_token_info |
modules/ |
Implements hook_token_info(). |
_token_example_get_comment |
modules/ |
Builds a list of available comments. |
_token_example_get_file |
modules/ |
Builds a list of available files. |
_token_example_get_node |
modules/ |
Builds a list of available content. |
_token_example_get_taxonomy_term |
modules/ |
Builds a list of available taxonomy terms. |
_token_example_get_user |
modules/ |
Builds a list of available user accounts. |
Classes
Name | Location | Description |
---|---|---|
TokenExampleTestCase |
modules/ |
Functional tests for the Token Example module. |