Provides an alternative Token browser element using HTMX for requests. Browse all tokens available on your site with no depth limitations.

Features

  • Browse deep nested tokens beyond the default recursion depth limit without crashing your site.
  • Visit the help page on your site at /admin/help/token_browser to see all available tokens.
  • For Developers: Provides an alternative theme function to attach token browser functionality to form fields.
    Replace '#theme' => 'token_tree_link'
    With '#theme' => 'token_browser_link'
    Example:
    $form['tokens'] = [
      '#theme' => 'token_browser_link',
      '#token_types' => ['node', 'user'],
      '#global_types' => TRUE,
    ];
    
  • As of version 1.0.1, administrators can globally alter the theme registry for every existing token_tree_link to automatically use this token browser. The settings form is available at /admin/config/user-interface/token-browser
  • As of version 1.0.2, administrators can set the size of the token browser modal when enabled globally.

Quick Start

To use this token browser everywhere on your site, do the following:

  1. Navigate to the settings form at /admin/config/user-interface/token-browser.
  2. Check the box Replace Token module's default browser sitewide (enabled by default).
  3. Check the box Force recursion limit. This is recommended.
  4. Optionally override Dialog options (defaults: Width = 800, Height = 500).
  5. Click Save configuration button.
  6. Anywhere you see a Browse available tokens link will now point to the Token browser route.

Integrations

These modules will automatically use the token browser form element provided by this module where applicable:

Similar projects

Fast Token Browser
This was a Drupal 7 module that never got ported but claims to achieve the same objective using ajax. My module uses the new HTMX library in Drupal core and completely eliminate the need for any Jquery.

Project information

Releases