Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Hi,
Thank you, thank you, thank you!!! I just discovered "Token Filter" and "Custom Tokens". Together these modules are providing a capability I've been searching for since starting into Drupal a couple of months ago.
Now my suggestion: It would be helpful if you would add something like the following to your project page:
How to use the Token Filter module
- Install and enable the module.
- Go to "Configuration > Content authoring > Text formats". Configure (or add) a text format that is only available to trusted users of your site. (Use of tokens by untrusted users is a security risk.) You will find a new filter available called "Replace tokens". Select that filter and click "Save configuration".
- Go to "Help > Token" to get a list of tokens available. There you will get a table with three columns: Name, Token, and Description. The name column at first provides a list of token types. Click the small arrow to left of any type name to get a list of tokens of that type. The items that appear in the "Token" column are the text you need to enter in the next step.
- Go to any content of your site, such as a page or an article. For the Body, select the text format that you just configured. Now enter some text that includes any of the items in the "Token" column of the previous step. Click "Save".
- Marvel that the token text has been replaced with its calculated value!
- If the tokens in that list aren't enough and you need to define your own, get the "Custom Tokens" module.
That would have saved me a lot of head-scratching once I enabled the module and thought, "Okay, now what?"
Comments
Comment #1
vonn.new CreditAttribution: vonn.new as a volunteer commentedThank you! Your little documentation here saved me a lot of headaches.
Comment #2
darvanenI agree that some more documentation is needed, however the documentation pages and readme file are the proper place for that.
Thanks for the suggested wording, I will probably use some of it when I can get around to creating the documentation pages.
If anyone is super keen I'm happy to create blank pages for them to edit.
Comment #3
darvanenFrom #2084337: Use updated terminology in description:
@kari.kaariainen says:
In the description it says "Token Filter is a very simple module to make token values available as an input filter." "Input filter" should be changed to "Text format filter" to avoid confusion for Drupal 7 users.
@silurius says:
Additionally, README.txt should be updated as follows:
Change:
Replace with:
2) Go to /admin/config/content/formats and enable "Replace tokens" for the Text formats in which you wish to make token values available.
Change:
Then in the text where you use that input filter you can use substitution tokens with
Replace with:
Then in a field using a text format with "Replace tokens" checked, you can use substitution tokens with
Comment #4
pmoz CreditAttribution: pmoz as a volunteer commentedThank you for some clarity to the OP.
Agreed that the readme is not sufficient or clear enough.
Comment #5
Webbeh> If anyone is super keen I'm happy to create blank pages for them to edit.
Happy to assist with this. Do we want to push this to the 8.x branch instead?
Comment #6
darvanenApologies for the delay @Webbeh, here's the stub, ready to be filled out:
https://www.drupal.org/docs/contributed-modules/token-filter
Comment #8
darvanenComment #10
darvanen.
Comment #12
darvanenComment #13
darvanenThanks @camerongreen for getting a start going on the documentation page, you may be interested in the small discussion here.
I've added credit for you, and others who have given constructive input.
Comment #14
darvanenComment #15
darvanen