I'm trying to debug creating a token. How to programmatically create a custom token in a module shows me how to create them.

Is there a way to display all available tokens? I'm trying to test if my module actually created that token.

  • Do you mean to show the value of the tokens, or to list all the available tokens? – kiamlaluno Jan 26 '12 at 21:53
  • Good point. I'll specify. – chrisjlee Jan 26 '12 at 21:56

There's a function in the token module called token_get_list() which is:

A helper function that retrieves all currently exposed tokens, and merges them recursively.

It invokes hook_token_list() for all modules so should give you every single token defined in the site.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.