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.

CommentFileSizeAuthor
#5 token-1271966-5.patch618 bytesJody Lynn
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Michelle’s picture

Changing 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

Dave Reid’s picture

Yeah this would only affect the UI and doesn't affect token replacement at all.

Michelle’s picture

Sounds perfect, then. :)

Thanks!

Michelle

13rac1’s picture

+1. Setting default tree depth to 3 would correct performance problems for most use cases.

Jody Lynn’s picture

Status: Active » Needs review
FileSize
618 bytes

Yes please. That would stop my sites from blowing up.

Berdir’s picture

Status: Needs review » Reviewed & tested by the community

Yes 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.

Dave Reid’s picture

Status: Reviewed & tested by the community » Fixed

Agreed this is a reasonable stop-gap for now. Committed #5 to Git. http://drupalcode.org/project/token.git/commit/b6766a3

liquidcms’s picture

sweeeet.. trying this now.. this sounds like it should allow the JS to finish loading on most of my admin pages.. :)

liquidcms’s picture

hmm.. 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..

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.