Problem/Motivation

On sites with a lot of tokens opening a page with the token replacement list will slow down the browser or even crash it.

Proposed resolution

The token module lately introduced the possibility to show tokens in a dialog which loads the tokens on demand using ajax: #1684984-17: Support opening token browser in a jQuery UI dialog on demand
The change is backward compatible.

Btw. loading the tokens in the dialog is still slow and still could crash the browser but at least it would be on demand :D

Remaining tasks

Review patch
I'm not sure if this plays well with accessibility concerns!

User interface changes

The tree list of tokens is replaced by a link to open a dialog with the token tree list.

API changes

none

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

das-peter’s picture

Title: Use the new token dialog to enhance » Use the new token dialog to enhance UX
wiifm’s picture

Status: Needs review » Reviewed & tested by the community

Patch is simple, applies cleanly, and works as expected. This is a must do.

AaronBauman’s picture

Category: feature » bug
Priority: Normal » Major

Recategorizing as a bug.
On a medium-size site, the large volume of tokens is actually causing a fatal memory error (256M exhausted).

Yes, the root cause is an issue in token, but it must be solved in webform.
This is a one-liner, let's get it in.

quicksketch’s picture

Category: bug » feature
Priority: Major » Normal

Thanks guys. Still RTBC, but it's not a bug in Webform. I'll put this in next time I'm going through the Webform queue.

quicksketch’s picture

Status: Reviewed & tested by the community » Needs work

This patch UI-wise doesn't make sense that we would have a collapsed fieldset with nothing but a link in it. We should append the token browser link to the existing description text. The token browser itself leaves a lot to be desired still (the fact that it doesn't have a scroll bar for instance), but that can be handled in the Token project.

AaronBauman’s picture

Status: Needs work » Needs review
FileSize
30.03 KB
1.21 KB

OK, here's an updated patch for theme_webform_token_help() to return a div instead of a fieldset.
I also added a selector class=webform-token-help to the div, since this patch changes the DOM.

Looks like this:
screenshot

das-peter’s picture

Status: Needs review » Reviewed & tested by the community

Made a visual review. Looks good to me, I claim it's RTBC ;)

quicksketch’s picture

For consistency and aesthetics, I moved the token help out of a dedicated element and added it to the description text of the field that supports the tokens. This makes our settings page consistent with the configuration of individual components, which show the token help in the description text for each field. This approach also falls back to using the previous fieldset if the token dialog is not available.

quicksketch’s picture

FileSize
74.78 KB

Screenshot of modified link location:
Token link

quicksketch’s picture

Status: Reviewed & tested by the community » Fixed

Thanks guys. Finally committed to 4.x.

Status: Fixed » Closed (fixed)

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