Early Bird Registration for DrupalCon Portland 2024 is open! Register by 23:59 PST on 31 March 2024, to get $100 off your ticket.
After installing token alpha 2 when submiting a image field (existing one in my case) I get this error :
The File directory is using the following invalid tokens: [date:custom:Y], [date:custom:m].
I've found several closed issues (fixed) about this problem in dev version. Might be a regression?
A similar issue is still open here though: https://www.drupal.org/node/2656240
Comment | File | Size | Author |
---|---|---|---|
#4 | 2662026-more-allowed-token-types-4.patch | 1.14 KB | bucefal91 |
Comments
Comment #2
BerdirThis was fixed with test coverage in #2642160: Needs tests: Default file field tokens ([date:custom:Y]-[date:custom:m]) fail Token validation.. Are you sure you are using the latest version? The fix should be in alpha2.
Comment #3
progzy CreditAttribution: progzy commentedI've installed a fresh Drupal 8.0.3 and the problem does not appear. This is the case on the website I am working on though.
However I've just managed to solve it this way (could be helpful if someone encounters the same issue):
- Edit the field ,remove the token from "File directory" text field and save the field settings
- Edit it again and re-add the token ([date:custom:Y]-[date:custom:m]) in "File directory" text field and save again
I thought I would have to do this for all my content type owning an image/file field but it seems to work for all of them with only one manipulation.
Weird ...
Comment #4
bucefal91 CreditAttribution: bucefal91 at Ocelot commentedI just hit a very similar issue when I tried to specify some tokens in the file's "destination" folder.
In my case I wanted it to be
monthly-reports/[node:field_report_date:date:html_month]
; we build these nodes automatically and we do provide into the token the corresponding $node object. It seems logical to allow tokens based on the entity type the "file" field is attached to. So I did this as a patch. :)I do recognize core "file" field will not support tokens based on the entity the file is attached to but in our case we generate these nodes programmatically and we do supply the necessary token $data to make it happen.
Comment #5
jollysolutionsWorks for me RTBCComment #6
Berdir> I do recognize core "file" field will not support tokens based on the entity the file is attached to but in our case we generate these nodes programmatically and we do supply the necessary token $data to make it happen.
Sounds like it is your responsibility then to add the token types in the UI as well? token.module can't add token types that then won't work?
Comment #7
jollysolutionsSpoke too soon. Does not want to upload file. It is trying to create the directory as the token name and not the value.
Comment #8
BerdirYeah, that's exactly what I mean. just documenting it doesn't make it work. Thanks for proving my point ,)