Summary
From a multivalue-filefield with 3 values in it, a token like [entityform:field-file]
returns Property 0, Property 1, Property 2.
But [entityform:field-file:file] returns nothing.
Details
Currently, all tokens on a multivalue-filefield will lead to a fatal error.
After applying the patch here #1440928-44: Entity tokens for multi-value fields produce a fatal error, the fatal error is gone for multi-value file field token. But adding properties like :file
or :file:url
still returns no values at all...
A (poor) workaround is to output each value separately:
[entityform:field-file:0:file] = shows the 1st file uploaded
[entityform:field-file:1:file] = shows the 2nd file uploaded
[entityform:field-file:2:file] = shows the 3rd file uploaded
etc.
I really doubt if I should have to list each and every file uploaded this way ? Since my file field is of unlimited value, how do I know the number of files uploaded by user ? Why can't I use [entityform:field-file:file] or [entityform:field-file:*:file] to automatically list out all the files uploaded ? Other field types have no problems listing all the values being bound with it. Currently, only File Field has to be specified as tested above.
Comments
Comment #1
klonos@jetwong98: you can refer to specific comments (that for example include uploaded patches) like so: [#issue_number-comment_number].
See for example how
#1440928-44: Entity tokens for multi-value fields produce a fatal error
in the issue summary automatically turned into a link to the specific comment.Comment #2
sirtetComment #3
sirtetComment #4
MrPeanut CreditAttribution: MrPeanut commentedAre you saying you're able to get a field url using the token above? I've tried
[node:field-image:0:file:url]
but that doesn't even seem to work for me (and I do only want the first file).Comment #5
sirtetYes, i get a full url like http://... ...jpg
Do u get anything if you try a less specific part ofyour token? Like [node:field-image:0]
Comment #6
MrPeanut CreditAttribution: MrPeanut commented@sirtet — Hmm, after trying
[node:field-image:0:file:url]
in Metatag and running it through Facebook's Debugger, they do pull the correct image. Not sure why I couldn't figure that one out!Comment #7
thejimbirch CreditAttribution: thejimbirch commentedThank Internet, @Klonos, @sirtet, @MrPeanut.
I was looking for how to use Media Module's File Entity Field to set a token for Metatag Image fields. This did the trick:
[node:field-image:0:file:url]
It is helpful to note that clearing the page on Facebook's Debugger or Twitter's Card Validator a few times is necessary if the url has already been shared on Facebook or Twitter.
https://developers.facebook.com/tools/debug/
https://cards-dev.twitter.com/validator
Comment #8
beyond67 CreditAttribution: beyond67 commentedI having the same issues with multi-value fields. I want to reference the description data for each uploaded file and use this text to rename the uploaded file.
If i reference it by putting in a number it will work [entityform:field-file:0:description] but i dont want to reference it this way since they are many files.
Can we use something like this: [entityform:field-file:*:description]?