- Issue created by @geoffreyr
- 🇦🇺Australia geoffreyr Sydney, AU / Gadigal country
I had a bit of free time and ended up starting work on the Token API guide. Here's what I have so far.
- Homepage →
- Overview →
- Usage info for devs →
- Hooks →
- Tokens provided by Drupal core →
- The Token contrib module →
- Upgrade guides →
The bits that I'm hoping will be most useful are the lists of available tokens and the hook implementation guides. It's pretty hard to generate lists of tokens in pretty-printed documented form so hopefully the former shouldn't change too much.
I thought that we couldn't really explain the Token system without having some info about Token module, since it provides entity field tokens which are pretty critical for extending the functionality of Token API itself.I spent some time going over the Token API codebase and reviewing the ins and outs of each section, so hopefully it's reasonably accurate. I'd say there are more passes to do before it fully fits the "voice" of the Drupal community, but hopefully it's useful.
- 🇦🇺Australia geoffreyr Sydney, AU / Gadigal country
Thinking about how https://www.drupal.org/node/390482 → provides a comprehensive list of D7 tokens with a lot of examples of chained tokens, but trying to replicate this would get very long and would be tedious to write. I wonder if there's some way to write a JS tool that does the same thing as Token module's Token Tree that lets people explore the list of default/Token module tokens and generate ones with the appropriate nesting... probably not something that would be hostable on drupal.org though.
- 🇦🇺Australia geoffreyr Sydney, AU / Gadigal country
Noting also that the old Token module handbook at https://www.drupal.org/documentation/modules/token → has some extra functionality that our guide doesn't yet cover such as using
token_element_validate
in#element_validate
. I think I'd probably want buy-in from the module maintainers themselves before I consider adding that -- don't want to duplicate their entire handbook without their say so beyond what's necessary to say what about Token module makes Token API really click.