Skip to main content
drupalreleases

Use direct release data with your AI assistant.

Learn more

Custom Token

Security covered Under active development 18 sites

This module allows administrators to create custom, environment-specific tokens without coding. Token keys are stored in configuration and exported, while their sensitive values are stored separately in the State API and are not exported, preventing accidental exposure in development or testing environments. These custom tokens can then be used like any other token throughout Drupal, including in webform email settings.

This module allows administrators to define dynamic tokens directly from the Drupal backend without writing code or touching configuration files for sensitive values.

How it works:

Two-store model:

  1. Token keys are saved to config - run drush config:export to commit them to the repository.
  2. Token values are saved to State API and are never exported - set them independently on each environment.

Token keys (machine names such as general_email, events_email) are stored in Drupal's Config API. These are exported via drush config:export and committed to the repository, so the token structure is consistent across all environments.

Token values (the actual email addresses or other environment-specific strings) are stored in Drupal's State API. State values are never exported and never committed to the repository.
Each environment - development, QA, production - sets its own values independently through the admin UI at /admin/config/system/custom_token_items.

Tokens are available site-wide as [custom_token:key] and can be used in:

  • Webform email handler fields (To, CC, BCC, options mapping)
  • Email subject lines and body text
  • Any other token-enabled field in Drupal

Why this approach:

Hardcoding client email addresses in webform configuration means they end up in the repository and get deployed to QA - creating a risk of test submissions reaching real recipients. This module eliminates that risk by keeping sensitive values out of the codebase entirely.

Drupal 9–11

Ask your assistant about Custom Token

Check compatibility with your Drupal and PHP version, maintenance and security coverage, from current release data. How it works

Depends on

Dependencies of the latest stable release

  • webform Drupal core

Required by

Tracked projects that depend on this one

No tracked projects depend on this one yet.

Activity

Tracked releases
2
Tracked since
Jul 2026
Latest release
2 months ago
Releases (12 mo)
2 ▲ from 0
Maintenance
Active

Releases

Version Type Core PHP Release date
1.0.0 Stable 9–11 Jul 17, 2026
1.0.x-dev Dev 9–11 Jul 17, 2026