Hello,
First, Imagefield can support user tokens, and it seems it does (as token_replace is used with "user" type : token_replace($field['widget']['alt'], 'user', $GLOBALS['user']).
But the help in the widget settings form does not show the user tokens, because of the call to theme_token_help : theme('token_help', 'file'). It should be, at least, theme('token_help', array('file', 'user')).

By the way, passing 'file' as argument does nothing : only global tokens help is diplayed at this time, and token_replace is not provided with a filefield object.
FileField seems to declare its tokens in the 'field' category (see filefield.token.inc), what is disturbing, because if we add the 'field' tokens help, we get the help for many fields (text tokens, date dokens, etc.).

What would be the best way to fix all these little bugs ? I volunteer to fix them, but need guidelines.

Thanks,

David

CommentFileSizeAuthor
#3 imagefield_token_help.patch1.05 KBquicksketch
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

quicksketch’s picture

The traditional approach is submitting a patch. Patches are easier to review than explanations, since they convey the exact changes that need to be made and can be applied directly to the code and committed. http://drupal.org/patch

If you can provide a patch for this issue I'll review it and then we can get it committed.

David Stosik’s picture

Well, I'll provide a patch.
But I don't know if I need to patch filefield or imagefield...
Will try patching imagefield first, and see reviews. :)

David

quicksketch’s picture

Priority: Normal » Minor
Status: Active » Fixed
FileSize
1.05 KB

For the time being I've committed this patch, which fixes the cosmetic problem of the help being inaccurate. Right now no module provides support for replacing straight-up "file" tokens (though I could see FileField as handling this responsibility). If FileField is made responsible, then an issue should be created over there and support added to ImageField in a follow-up.

quicksketch’s picture

Title: User and filefield tokens support in alt and title fields » ImageField token help does not show all "user" tokens

Status: Fixed » Closed (fixed)

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