had anyone of you had a problem with too large amount of tokens? Because of having few content types (~8) with bunch of fields (~5-10 each) Token module generates too big table with replacement tokens. This is why I had to increase in settings.php available memory to avoid drupal from php error. I set 512M so it generates the output table now but it is so slow that it freezes Chrome.

It happens where I have this preview of available tokens. So it can be found in Pathauto or Custom Breadcrumbs.

This is how it looks like in Google Chrome HTML preview:


  • this is how it looks like in Chrome html preview: img687.imageshack.us/img687/589/zrzutekranu20110916o153.png ... few modules, few content types, few fields.. and it multiplies final output size.
    – wtk
    Sep 16, 2011 at 13:42
  • Ok, I found the culprit. It was because of Token Entity module (it generates tokens for things that are normally unavailable).
    – wtk
    Sep 16, 2011 at 15:11
  • I should and I would if not a stupid rule that as new registered user I couldn't have done that that fast :] Now I will post solution.
    – wtk
    Sep 19, 2011 at 13:02

3 Answers 3


You can find some solutions for such a problem on Node references + Entity Tokens creates HUGE Token Tree UI table HTML.

Using the Token tweaks module also helps. I've tried and it works fine.

Provides tweaks for tokens (mostly to improve performance)

  • Disable token types or specific tokens.
  • Modify the default depth limit for the token tree UI.

Token Tweaks worked for me, but if you have a general disdain for adding more modules you could try the patches at Prevent recursive tokens.

You can also change TOKEN_MAX_DEPTH in token.module. For me, changing the value to 1 led to a load time of 1 second. 2 made it 5.23 seconds. 3 or more pretty much crashed the browser. You'd still probably want to make a patch of the change in this case and/or keep a backup of the token.module file, or make Hacked a part of your module update process.


You can stop token_help rendering in Drupal 7.

If you don't need tokens on a given form and too many fields on too many content types is causing performance issues, you can replace the theme function for the list of avaiable tokens and replace it with a link back to the same page with a variable set where you would like to see the tokens.

By default, it won't render the tokens, but if you want to view a page with the tokens you can:

function nys_utils_theme_registry_alter(&$vars) {
  $vars['token_tree']['function'] = 'nys_utils_theme_token_tree';   

function nys_utils_theme_token_tree($variables) {
  if(isset($_GET['show_tokens']) && $_GET['show_tokens'] == 1) {
    return theme_token_tree($variables);
  } else {
     return l('show tokens',$_GET['q'], array('query' => array('show_tokens' => '1'))); 

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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