Examples using the Token API.

Tokens are small bits of text that can be placed into larger documents via simple placeholders, like %site-name or [user].

Backdrop documentation on Token can be found here: http://DOCUMENTATION_PENDING/documentation/modules/token

A list of existing tokens can be found here: http://DOCUMENTATION_PENDING/node/390482#backdrop7tokenslist

This example is part of the Examples for Developers Project which you can download and experiment with here: http://DOCUMENTATION_PENDING/project/examples

Parent topics

File

modules/examples/token_example/token_example.module, line 11
An example module showing how to define and use tokens.

Functions

Name Locationsort descending Description
token_example_menu modules/examples/token_example/token_example.module Implements hook_menu().
token_example_entity_info_alter modules/examples/token_example/token_example.module Implements hook_entity_info_alter().
token_example_example_form modules/examples/token_example/token_example.module Form builder; display lists of supported token entities and text to tokenize.
token_example_example_form_submit modules/examples/token_example/token_example.module Submit callback; store the submitted values into storage.
_token_example_get_node modules/examples/token_example/token_example.module Builds a list of available content.
_token_example_get_comment modules/examples/token_example/token_example.module Builds a list of available comments.
_token_example_get_user modules/examples/token_example/token_example.module Builds a list of available user accounts.
_token_example_get_taxonomy_term modules/examples/token_example/token_example.module Builds a list of available taxonomy terms.
_token_example_get_file modules/examples/token_example/token_example.module Builds a list of available files.
token_example_token_info modules/examples/token_example/token_example.tokens.inc Implements hook_token_info().
token_example_tokens modules/examples/token_example/token_example.tokens.inc Implements hook_tokens().

Classes

Name Locationsort descending Description
TokenExampleTestCase modules/examples/token_example/token_example.test Functional tests for the Token Example module.