Skip to content

About

Backdrop CMS module to allow you to create custom tokens

Resources

Stars

1 star

Watchers

3 watching

Forks

Repository files navigation

Custom Tokens

Custom Tokens allows users to define their own tokens via the administrative UI using standard input filters. These tokens can then be used throughout the site in any field that supports token replacement.

Requirements

  • No hard dependencies.
  • Recommended: Token Filter, to use custom tokens in body text and other formatted fields.

Installation

Install this module using the official Backdrop CMS instructions at https://docs.backdropcms.org/documentation/extend-with-modules.

Configuration and Usage

  1. Text Formats: Visit Configuration > Content authoring > Text editors and formats (admin/config/content/formats). With Token Filter installed, enable its "Replace tokens" filter for the text formats you intend to use.
  2. Creating Tokens: Navigate to Structure > Custom Tokens (admin/structure/token-custom).
  3. Nesting: You can use existing site tokens (like [site:name]) inside your custom token content. A token cannot contain itself, directly or through other custom tokens; it is left empty and a warning is logged.
  4. Placement: Use your custom token anywhere tokens are accepted using the syntax [custom:your_machine_name].

Pro-Tip: Avoiding Paragraph Tags in Snippets

If you are creating "Inline" tokens (like a Company address "Line1, Line 2, Area, City, Zip Code") and find that they are being wrapped in <p> tags:

  • Go to Configuration > Content authoring > Text editors and formats (admin/config/content/formats) and create a "Plain" or "Snippet" text format.
  • Ensure "Convert line breaks into HTML (i.e.
    and

    )" is disabled for that format.

  • Set the Editor to "None" for that format.
  • When creating your custom token, select this new format to ensure the output is returned as raw text without HTML wrappers.

Note: As of version 1.x-1.3, PHP execution within tokens is no longer supported in favor of Backdrop security best practices.

Documentation

Additional documentation is located in the Wiki: https://github.com/backdrop-contrib/token_custom/wiki

Issues

Bugs and Feature requests should be reported in the Issue Queue: https://github.com/backdrop-contrib/token_custom/issues

Security

Reviewed on 29 October 2026 for the kinds of vulnerability reported in the Drupal security advisories of 7 to 28 October 2026. Those advisories were for Drupal 10/11 and do not apply to Backdrop directly; this module was checked for the same classes of mistake.

Please report security issues privately to security@backdropcms.org, not in the issue queue.

Maintainer(s)

Credits:

  • Steve Moorhouse - Zulip (DrAlbany)
  • AI Assisted

Original Authors

This module is a port of the Drupal Custom Tokens module.

  • Ariel Barreiro (hanoii)
  • Rodolfo Ripado (gaspaio)

Sponsorship

License

This project is GPL v2 software. See the LICENSE.txt file in this directory for complete text.

About

Backdrop CMS module to allow you to create custom tokens

Resources

Stars

1 star

Watchers

3 watching

Forks

Releases

Packages

Contributors

Languages