theme_token_help for a specific node.

drewish - July 31, 2007 - 00:22
Project:Token
Version:5.x-1.x-dev
Component:Code
Category:feature request
Priority:normal
Assigned:Unassigned
Status:needs review
Description

I've just committed #163245 which adds token support to the audio module. I use the tokens to build titles and teasers automatically. I'm really impressed with how easy it was and how well it works.

I have only one complaint and it's a minor one. The node's title is built using tokens so I provide a collapsed field set with the results of theme('token_help', 'node'). This works but it lists a lot of tokens that may not be defined for that particular node. I'd love it if I could pass the node into theme_token_help() and have it return a formatted list of the tokens that are defined for that particular node.

ps, want to add audio 5.x-2.x-dev to the list of supported modules? ;)

#1

fago - August 1, 2007 - 09:36

yep, I agree that this would increase the usability of the tokens a lot. Unfortunately it won't be easy to implement...

ah and you could add workflow-ng too.. :)

#2

drewish - August 1, 2007 - 15:06
Status:active» needs review

fago, there's no better motivator for me than someone saying one of my ideas would be too hard to implement. so here's a patch. i'm sure the token devs will have some better ideas of how to set it up but it's a working prototype.

AttachmentSize
token_163275.patch 1.65 KB

#3

fago - August 2, 2007 - 10:46

hm yes, but the given node is seldom available on configuration time - so this would be hard to use, or?
I would love to be able to state the used node type, for which then I get the replacements

#4

greggles - August 21, 2007 - 05:21

I added audio to the list of modules - thanks for the tip.

About this help...I agree with fago in #3 - how often is a $node object actually available?

I think better would be to create your own module specific plain html help information...

#5

fago - August 21, 2007 - 07:13

Could you add workflow-ng too please?

@topic: That's difficult too.. If the node type changes, the available token changes too..

#6

arhak - September 14, 2009 - 05:11

I would recommend you to start splitting theme_token_help into two separated theme functions like #576592: theme_token_list (split theme_token_help in two) (which is a D6 issue)
then, every replacement list that might be needed can be easily themed with theme_token_list once the list of tokens gets filtered

 
 

Drupal is a registered trademark of Dries Buytaert.