Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
I'm trying to think of why I had 4 set as a default. I think it was for field tokens - [node:field_name:values:0:something] would be 4 levels deep.
Comment | File | Size | Author |
---|---|---|---|
#5 | token-1271966-5.patch | 618 bytes | Jody Lynn |
Comments
Comment #1
MichelleChanging the default and making it configurable would be great. Then you have the faster loading in most cases with the ability to put up with slower loading if you really need to get at a deep token.
I'm pretty fuzzy on how tokens work... If you set it to 3 normally, then the admin sets it to 4 to get a deep one in the list, but then sets it back to 3 for normal use, will that deep one be accessible when the token is being used? In other words, does this setting affect only the admin screens or the actual usage as well?
Michelle
Comment #2
Dave ReidYeah this would only affect the UI and doesn't affect token replacement at all.
Comment #3
MichelleSounds perfect, then. :)
Thanks!
Michelle
Comment #4
13rac1 CreditAttribution: 13rac1 commented+1. Setting default tree depth to 3 would correct performance problems for most use cases.
Comment #5
Jody LynnYes please. That would stop my sites from blowing up.
Comment #6
BerdirYes please!
Depth 4 resulted in multiple thousands of tokens (user with fields -> node with fields -> media gallery with fields -> ... + the current token/entity_tokens issue) on a site here and it killed both the site and the browser when trying to display it.
I guess an optimal solution would be to only display 2 or so and load deeper levels with ajax on the fly :)
I appled the patch and the token browser is still slow but already much better. RTBC.
Comment #7
Dave ReidAgreed this is a reasonable stop-gap for now. Committed #5 to Git. http://drupalcode.org/project/token.git/commit/b6766a3
Comment #8
liquidcms CreditAttribution: liquidcms commentedsweeeet.. trying this now.. this sounds like it should allow the JS to finish loading on most of my admin pages.. :)
Comment #9
liquidcms CreditAttribution: liquidcms commentedhmm.. well not the major improvement i thought it might be.. pages with token browser still need 1 or 2 refreshes to load completely. i set recursion depth to 2 and then i think pages were loading completely.. although maybe sporadic. at 1 it seemed faster and reliable.
but at 1 i still get tokens like this: [user:field-discipline:field_attachments] , so perhaps i don't get what depth is referring to here and i think there are still 1000's of tokens being listed. ajax loading of each category is likely the way to go here..