I want to have one field for header images, but sort them by type of content. Sadly, when I try to do that, I get:
The File directory is using the following invalid tokens: [content-type:machine-name].
there is no "avaliable tokens" link under File path box, but when I click generic one, I get:
- Current date - Tokens related to the current date and time.
- Current page - Tokens related to the current page request.
- Current user - Tokens related to the currently logged in user.
- Random - Tokens related to random data.
- Site information - Tokens for site-wide settings and other global information.
- Variables - Tokens for variable values.
Now, I can add Node to the list with File (Field) Paths, but that's overkill. I want more basic thing - content type or more generic bundle tokens. And they are not provided. Is there something I'm missing?
hook_tokens()
method based on a node object). The interesting part is altering the field validation/submission process to inject the relevant entity and base the file path on thetoken_replace()
result. While also maintaining file naming standards and coping with errors on the fly. It's not a particularly trivial task, hence why File (Field) Paths is so full of bugs