Download & Extend

Allow tokens to be used in the default value of a field

Project:Token
Version:7.x-1.x-dev
Component:Code
Category:feature request
Priority:normal
Assigned:Unassigned
Status:active

Issue Summary

If possible with the new Field API, it would be helpful to be able to use tokens in the default values for fields. This was requested by Bevan in the comments on another issue (http://drupal.org/node/691078#comment-3813316), but I couldn't find where a separate issue was ever opened for it.

Comments

#1

I thought I had looked into it before and found it almost impossible to be able to do this on a consistent basis. I'll take a look again.

#2

Status:active» postponed

Also considering CCK in D6 didn't support tokens in it's provided fields (text, etc) this isn't too high a priority.

#3

Subscribe

#4

subscribe

#5

subscribe

#6

Title:Allow tokens to be used in the default value for a field» Allow tokens to be used in the default value and help text for a field

#7

#8

Hi guys, I wrote a small module for supporting tokens in default values of fields. Its quite a bruteforce solution - its checking all "*_node_form" forms and alters the content by replacing all occurances of tokens by their specific values using token_replace(), but maybe it will be usefull anyways.

Its actually my first post here on drupal.org so if I did something wrong by posting here a minimodule I am sorry for that!

AttachmentSizeStatusTest resultOperations
tokens_as_default.zip2.41 KBIgnored: Check issue status.NoneNone

#9

Hi, guys.

For the help text part, you might be interested in #1308564: Basic token support in fields' help texts.
It is a trivial patch (take a look yourself) and it works for me, but more peer reviewing is definitely needed.
Maybe it gets into core if there is enough peer review.

HTH.

#10

amontero, I revised your patch a bit. check issue #1308564: Basic token support in fields' help texts (patch provided)

If you're interested in this feature, please support the issue!

#11

Subscribe

#12

Subscribe

#13

Subscribing

#14

Status:postponed» active

Can we move this issue to active? This seems like a perfectly valid feature request and it's not like it's being postponed based on any other pending issues right?

@khm I have not tested your module, but it would obviously be better if we could integrate your work into a patch somehow for this module as that would be more easily tested and helpful.

#15

Quite agree!

See default value with token replacements, it has been solved in D6.

Currently, only viewfield supports this:
dd

#16

Title:Allow tokens to be used in the default value and help text for a field» Allow tokens to be used in the default value of a field

As mentioned above, there is an ongoing issue for #1308564: Basic token support in fields' help texts. madmatter23 added there a patch to support them in default values that might be of interest here.
As described in this comment I've split token support in help text and default values in different issues to ease them.
Token support for help text patch passed tests successfully. You might be interested in reviewing it, also.
Issue linked and title updated.