Early Bird Registration for DrupalCon Portland 2024 is open! Register by 23:59 PST on 31 March 2024, to get $100 off your ticket.
Hello,
Please, help with drafting filefield_paths rules when uploaded files will be stored in a folders depending on the term selected from the vocabulary Category
It's possible in 8.x?
[node:field_category] returns string with superfluous content (language code, html tags etc)
files/<a href="/en/taxonomy/term/21" hreflang="en">category_term</a>/file.doc
Thanks
Comments
Comment #2
cka3o4h1k CreditAttribution: cka3o4h1k commentedComment #3
cka3o4h1k CreditAttribution: cka3o4h1k commentedComment #4
cka3o4h1k CreditAttribution: cka3o4h1k commentedComment #5
cka3o4h1k CreditAttribution: cka3o4h1k commentedComment #6
cka3o4h1k CreditAttribution: cka3o4h1k commentedComment #7
Deciphered CreditAttribution: Deciphered at Realityloop commentedThis is expected behaviour with the token you are using. The token is provided by the Token module, and Token module Field tokens are run through the Token view mode for the particular bundle.
In Drupal 7 I would always recommend using the the Entity API modules Entity Tokens sub module, but that is not currently available for Drupal 8.
As far as I know, the current approach to achieve what you want is to do the following:
You can test what a token will render as by creating a node, then running the following code via the Devel PHP interface:
I will be beginning the port of my Field Tokens module today, which provides similar functionality to the Entity Tokens sub-module, allowing you to achieve the same goal as above without messing with the Formatter settings.
Comment #8
Deciphered CreditAttribution: Deciphered at Realityloop commentedBeta 1 of Field Tokens released, you could use the following token now to achieve what you need:
[node:field_category-property:0:entity:name]
Comment #10
cesarg CreditAttribution: cesarg commented#8 worked for me, thank you very much! @Deciphered