It took me a long time to figure out this simplest use of custom tokens after considerable searching, so I thought I'd drop my solution here. What I wanted to do was set up a global site variable that is easily editable in the Admin section by non-programmers. For example, say I wanted a list of keywords that any module, page, etc could access.
In the token admin I created a token called "token_custom_keywords"
The content of this token was:
print "good,nice,friendly";
Then anywhere else on the site I could access this as:
$myTokenString=token_replace("[token_custom_keywords]");
This works just as I wanted. Although if there's another module that does this in a more efficient way, I'd love to hear about it!
Issue fork token_custom-1247618
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #1
manuel.adanComment #2
ressaI still think this is relevant ... I looked at the documentation https://www.drupal.org/docs/extending-drupal/contributed-modules/contrib..., but it says it is for the old version ("This page and its children are for old releases of the Custom Tokens module. See #2912199: Documentation").
Also, there isn't much in the README file ...
It would be great with a very simple example in the README or on a doc page, which shows what makes this module great, and how to set it up. Thanks!
Comment #3
anybodyYeah anyone feel free to create a proper and helpful README.md and updated description for the module page.
Comment #5
jatin.buzz commentedWorking on it!
Comment #7
jatin.buzz commentedPlease review readme.md improved