Better token lists

Events happening in the community are now at Drupal community events on www.drupal.org.
sirkitree's picture

Has anyone come up with a better way of presenting the list of tokens to users? I'm finding that what I'm doing is really ugly and would love to know if anyone has seen any good examples of how to present tokens in a more usable manner.
Only local images are allowed.

Comments

three modes I've seen

greggles's picture

Crossposted to usability gruop.

The three modes that I've seen people use are:

  1. The one in sirkitree's screenshot in the original post.
  2. Pathauto style: does it's own processing to get a list of tokens that will work for the current scope (e.g. nodes). Reduces the number of tokens somewhat, but not a ton.
  3. Don't include this advice under the field, instead say "You can use tokens here like [foo], [bar], and [baz] or see the detailed help page for more details." Then put the full list in the help page. Ubercart does this in several places.

I've thought some nice additional styles though never implemented them (nor seen them implemented).

  1. A jquery based filter mechanism at the top of that big list.
  2. An autocomplete style mechanism that would be most useful for single line textboxes.

Anything else?

--
Growing Venture Solutions | Drupal Dashboard | Learn more about Drupal - buy a Drupal Book

I think a jQuery text filter

akahn's picture

I think a jQuery text filter textarea at the top of the list of tokens would be ideal. Just type in 'menu' and the list is immediately pared down to the ones that contain the text 'menu,' and there's still room for the descriptions below each token. There are jQuery plugins that make this really easy, though I've mostly seen them used on table rows.

idea about jQuery text filter

pgautam's picture

Yes idea about jQuery sounds to be great but for someone who is not using javascripts and jQuery on his side can use dropdown or something else to show tokens.

Popunder? I'm not sure what

markpeak's picture

Popunder?

I'm not sure what does it call. But the same as Greybox image module. Help dialog popup within the admin page.

Popups

sirkitree's picture

Yes popups would be good for this. Especially combined with the external help page link as greggles mentioned. I think I'll go that route, but I REALLY like the jQuery filter idea too... hrm...

Something like the jQuery

edkwh's picture

Something like the jQuery Tag Suggestion plugin (http://remysharp.com/2007/12/28/jquery-tag-suggestion/) perhaps?

As for the long list of tokens, maybe we can follow the how Views allows you to Fields filter by categories.

Here's what I've decided

sirkitree's picture

Here's what I've decided upon.

First limit the scope. This cuts down on the amount of tokens as Greg suggests in #2 with the Pathauto style.
Then make each type a collapsible fieldset, resulting in the following:
Only local images are allowed.

good job!

likewhoa's picture

I noticed this is what you implemented with activity-2.x, keep up the good work. This method improves productivity by 1000%.

bending technology to fit businesses.

Good to report back on what

yoroy's picture

Good to report back on what you actually chose to do. Thanks. Seems like a fair solution. Presenting long long, very long lists of stuff is a recurring UI problem and I think you picked the right option for this case.

Only issue with this is that the fieldset titles become very important because that is the only thing you get to base your initial choice on. You might consider dropping the repetitive 'tokens' from all nested fieldset titles, it's pretty clear we're administring tokens already, no need to keep saying it. Omit needless words.

Vertical tabs?

frank ralf's picture

You could make the fieldsets into vertical tabs. That would provide you with some more space for additional information.

Token lists? How? Where?

o4tuna's picture

My ultimate goal is to customize Mail Templates that are used when Drupal 5 sends out subscription notices--using tokens to effectively pick and choose which parts of the full node that get sent out to the subscribers.

The standard page for editing a mail template shows a list of tokens (!title, !body, !full_node . . .), but I'm thinking there has to be more than that. The problem is that I don't know how to find or produce a "dictionary" of available tokens.

I've installed the Token module, btw. Apart from a somewhat obscure appearance on the admin/build/modules page, I can see no sign that the module is doing anything.

Is there a script I could just paste (I'm no PHP wizard) into the body of a page that would reveal a dictionary of tokens? I'm especially interested in finding a token for attached files.

Let's focus on improving the

dave reid's picture

Let's focus on improving the token UI that was planned for core but was too late so it went into Token module (for D6 and D7).

It was really easy to do a better UI for Drupal 7 since we got a very improved token system into core that allows for chaining. You can see how it looks with D7 at my demo site: http://www.davereid.net/d7/examples/token.

We did also backport this tree UI to Token module for Drupal 6, although it does not provide a lot of improvement since there are only so many token 'groups' and a mass of tokens dumped into each group. And because we can't break the existing token API for D6, we can't really change the way this works.

Any module that wants to use the token tree UI in their module should see example code in the Examples or Pathauto modules.

Senior Drupal Developer for Lullabot | www.davereid.net | @davereid

Looks (and works) great!

frank ralf's picture

Wow, that's cool - especially the one-click & scroll-back-into-view feature ;-)

token noob

drupaljohngo's picture

I understand using tokens in titles and certain text fields. Tokens to me work like shortcodes in wordpress. Or at least should in my mind. What I noticed is using the audio module was I could get an album title listed in the title field [audio-tag-album]. Great and super duper.

I tried the same tag in the body field. Nothing.

So, Where can I use tokens and where can I not?

I see this as useful for say triggering an action for a notification liken to the following button on Drupal issues.

With shortcodes in wordpress it's great for non-coders wanting a frame, textbox or whatever complicated java scrpt / jquery in the wysiwyg editor.

Maybe use more so in the rewrite field of views or Panels custom textbox?

Usability

Group organizers

Group categories

UX topics

Group notifications

This group offers an RSS feed. Or subscribe to these personalized, sitewide feeds: