The API Tokens module provides an input filter that allows to replace custom parametric tokens with rendered content. Each declared token binds to its handler function, that returns content, token will be replaced with. Token may contain parameters that will be passed to its handler function.
For example, you can declare a token which will render a current date on each page reload as follows:
or render blocks:
or even views:
[api:view["view_name", "display_id"]/] - without arguments
[api:view["view_name", "display_id", ["arg1", "arg2"]]/] - with arguments.
Each module is able to define its own parametric tokens and corresponding render functions. Module provides flexible caching mechanism.
Since API tokens accept parameters, it is highly advisable to add all required checks to your render functions to avoid performance impact and fatal errors.
Note that API Tokens module does not provide any visible functions to the user on its own, it just provides handling services for other modules.
- Install as usual, see https://drupal.org/node/895232 for further information.
- Go to /admin/config/content/formats and enable the API Tokens filter for any of your existing text formats or create a new one.
- Declare some tokens and process functions (see api_tokens.api.php and api_tokens_example).
- List of all registered tokens available at admin/config/content/api-tokens.
- Alex Zhulin (Alex Zhulin) - https://drupal.org/user/2659881
This project has been sponsored by:
- Blink Reaction
Blink Reaction is a leader in Enterprise Drupal Development, delivering robust, high-performance websites for dynamic companies. Through expertise in seamless integration, module customization, and application development, Blink creates scalable and flexible web solutions that provide the best in dynamic user experience. Specialties: Custom Drupal Development, Enterprise Drupal Development, Fortune 500 Clients, End to End Solutions.
- Whole Foods Market
America’s Healthiest Grocery Store™
Who are we? Well, we seek out the finest natural and organic foods available, maintain the strictest quality standards in the industry, and have an unshakeable commitment to sustainable agriculture. Add to that the excitement and fun we bring to shopping for groceries, and you start to get a sense of what we’re all about. Oh yeah, we’re a mission-driven company too.
- Maintenance status: Actively maintained
- Development status: Under active development
- Module categories: Filters/Editors
- Reported installs: 918 sites currently report using this module. View usage statistics.
- Downloads: 6,756
- Last modified: January 16, 2017
- Stable releases for this project are covered by the security advisory policy.
Look for the shield icon below.