When creating a contenttype
with the following fields:
text (core)
integer (core)
serial_field(gets auto filled in)
Module token default value https://www.drupal.org/project/field_default_token
Result text field with default value
[field_text_text] - [field_ineger_integer] - [field_serial_serial]
On node save: the node is created but only the [field_text_text] is substituted for the right value.
the other 2 are substituted with empty.
So on which hook does token_module get it data?
The serial_field value gets created on hook_presave
Can you use tokens of the same new page that they are all created?
Comments
Comment #1
dave reidMaybe a better question for the module you are specifically referring to, Field default token.
Comment #2
ikeigenwijs commentedIts unrelated of field default token i think its also so for entity auto label witch also uses token.
could you tell me when token gets its values?
Comment #3
ikeigenwijs commentedThe common denominator is token so changed back to token project.
I think it has to do with the order of the node construction/save order of all the different hooks/steps.
I respected the order on the page, the tokens used are only for previous fields.
Or token should do 2 runs 1 what it does now and again to fill in all the unknown tokens of the previous fields.
this would give a lot of overhead.
Im going to test this stratagy using rules triggered on entity/node save action.
Comment #4
dave reidI'm having a hard time understanding what the problem is you're trying to describe. It's hard since you're not using real token names in your description. I'm not sure if you're using Field default token or Auto entity label, or something else at this point. It would be incredibly helpful to provide clear steps to reproduce your issue from a fresh install of Drupal 7 + Token module + the minimum amount of contrib modules to demonstrate the problem.
Comment #5
ikeigenwijs commentedon simplytest.me
Used projects
token
auto_entitylabel
entity
field_default_token
serial_field
enable all mentioned projects
add in a contenttype in this order a
text field named text
integer field named integer
serial field named serial
text field result (will use tokens to get filled in with default value)
with default value tokens:
i:[node:field_integer] - s:[node:field_serial] - t:[node:field_text]
set the entity auto label as (uses tokens again)
Automatically generate the label and hide the label field
i:[node:field_integer] - s:[node:field_serial] - t:[node:field_text]
create some nodes for your contenttype
1 one "leave result empty"
2 two "leave result empty"
this on the side:
the nodes get created see content but link throug does not work with pathauto without path auto ok
the page save confirmation message is not correct
Basic page i:1 - s: - t:one has been created.
gives:
i:1 - s: - t:one (page confermation)
title is correct
result field(not correct):
i: - s: - t:
should give for the first node:
i:1 - s:1 - t:one
everywhere
i hope this makes it more clear. I added serial becouse we also use it but its not the source of the problem.
Comment #6
ikeigenwijs commentedAdded a screen shot of the result when creating a node, the redirect fails, but the node is created with the correct node title.
Added a screen shot of the created node.
Comment #7
ikeigenwijs commentedForgot to set the flag to active...
Comment #8
ikeigenwijs commentedComment #9
ikeigenwijs commentedanother related issue
https://www.drupal.org/node/2177347#comment-9677375