The Token module provides hooks to other modules to serve their own tokens. Multiple modules that support Token integration can generate a really huge nested table tree when displaying the available tokens in the field settings:

Token Replacement Patters

This can lead to out-of-memory issues in Views settings or regular field settings:

Token Views fields - field settings + out of memory

Token nested tables - field settings + out of memory

Earlier I created an issue related to this problem: http://drupal.org/node/1836264. Until a possible solution comes there (e.g. a patch), I would like to solve it my own (it doesn't matter if I temporarily have to "hack" Token's core): I would only like to load this table with the available tokens "on-demand" with AJAX or any other possible solution.

Do you have any ideas how to solve this?

  • I agree, this is totally nasty. A form that includes the entire token tree can add tens of thousands of lines of markup to the html output of the page. Check out drupal.org/node/1684984 and drupal.org/node/1229568. Nov 16, 2012 at 0:07
  • @CharlieS: thanks for the linked issues, these are really helpful! :)
    – Sk8erPeter
    Nov 16, 2012 at 7:28
  • @CharlieS: When reading the issues, I found Token tweaks module, with which you can set a depth limit for the token tree - it seems like it solves my problem, no more out of memory issues when setting the depth limit to 2. Could you please post these issues and the link to this module as a separate answer? I would accept yours then. :) (I'm just looking for a temporary solution, until things mentioned in Token UI 2.0 issue get fixed somehow.) Thanks!
    – Sk8erPeter
    Nov 16, 2012 at 8:15

1 Answer 1


The default token tree can contain many thousands of lines of HTML, and the corresponding Javascript listeners and functionality can totally break things memory wise (or just give you a darn laggy experience). Plus it can confuse the heck out of site administrators.

These issues refer to current developments for loading the token tree 'on demand' or via a popup:

And OP pointed out in his comments, the Token tweaks module lets you set a depth limit for the token tree, which seems to have solved his memory problem.

  • Thank you very much! :) There's another ongoing issue thread since then: drupal.org/node/1842738. I hope there will be a real solution soon (not just limiting the available tokens with setting the depth). :) +1 and accepted.
    – Sk8erPeter
    Nov 16, 2012 at 16:49

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.