Score:0

How to use [node:title] token as filename for media type fields?

gt flag

I have a Drupal 9 site have two modules FILE (FIELD) PATH module and token is used.

So for a content type, one image field is there where in the File (Field) Path settings I have the file name as [node:title].[file:extension] and it works. https://nimb.ws/z8imjN

But when I add a media field, and go here admin/structure/media/manage/image/fields/media.image.field_media_image to add the file as [node:title] it doesn't allow me. Giving me this error File name is using the following invalid tokens: [node:title].

I clicked on the Browse available tokens and the node tokens doesn't appear in it for media.

I did some testing on my local and checked, if the Tokens module is not installed then on media it allows us to add [node:title] as filename in the file path settings of the the media fields.

Any way I can add the [node:title] with tokens module still installed? or any other suggestions?

ru flag
You can't. Only a node field can only use `node:` tokens. A media field can only use `media:` tokens. (Apart from global tokens like `site:` etc of course).
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.