#1068990: Optimize and add caching for theme_token_tree() is at an impasse. Token says it's Entity Token's fault for dumping in too many tokens, Entity Token says it's Token's fault for not being able to handle that many. Yesterday, I discussed with Dave on IRC the possibility of bringing in a third option for a solution: Make tokens individually disable-able. This has another advantage of making the list easier to scan through even where slowness isn't a problem.
I'm writing up some thoughts in this issue but this isn't necessarily something that Token itself would provide. Plus, I don't have the ability to write this; I'm just documenting the proposal.
Basically, either Token itself or a 3rd module would provide an admin page that lists all tokens from all enabled modules. The admin would then be able to check which ones Token provides as options in all the places tokens are used.
What is on by default needs to be decided:
1) Make all non-core tokens disabled by default and contrib token providers are responsible for communicating to the user how to turn theirs on.
Pro: Pages using tokens are speedy by default.
Con: Users may not understand why only some tokens "work".
2) Make all tokens enabled by default.
Pro: Default behavior is the same as it is now with all tokens available.
Con: The default behavior can lead to unusably slow admin pages when modules that have a lot of tokens are used. It isn't obvious that token is the source of the slowness and can be frustrating for the admin to track it down first in order to know they have to go disable some tokens.
Thoughts?
Michelle
Comments
Comment #1
johnv1) "Make all non-core tokens disabled by default" is a good idea: It's uncomfortable to find my three favorite tokens in the dozens of others.
A solution for "Con: Users may not understand why only some tokens "work" would be in the display of the token tree: Token tree scan show only the active tokens, ánd a link, or a second (collapsed) tree with ALL tokens. A help text 'Only active tokens are shown. Click here to show all tokens.' would show the token admin page or the complete token tree.
The token can then be activated a) by the user, or b) automatically upon first time usage.
Comment #2
dave reidI don't think that this should be the responsibility of token module proper, so moving this to Token Tweaks.
Comment #3
michelleHey, that works! Thanks. :)
Michelle
Comment #4
apmsooner commentedI set tree depth to 2 and seems to work pretty good for me with entity tokens enabled. I tried 3 at first and tokens ui for a content type with automatic nodetitles caused timeout issues so seems 2 is the way to go for me.
Comment #5
michelleSetting the depth to 3 works for me. :) I still think being able to pick from a list would be helpful, but the depth is a quick fix and works. :)
Michelle
Comment #6
BenK commentedSubscribing
Comment #7
Anonymous (not verified) commentedMy idea:
Make seperated tabs: core tokens | other token 1 | other token 2 | oth...
Other tokens are tokens from other modules, for example feed tokens, date tokens or entity tokens.
By default only load core tokens.
Load other tokens when selecting the corresponding tab, remove other tokens from memory/cache after selecting a tab and before loading the new token tree
Pro's:
Con's:
Comment #8
joelpittet@cmseasy that sounds like a good idea. The only thing I could think of that we'd have to deal with is existing sites needing all the tokens.
So you are better to load/enable them all by default in an update hook so existing sites don't break.