Node's tokens (Tokens related to individual content items, or "nodes".) are not present in field settings.

This is a problem for example if one want to specify a image path that depend of node:id. Or a default image alt that is the same that the node title.

Comments

Golem07’s picture

Title: "Nodes" tokens gone on some partes of the site » "Nodes" tokens gone on some parts of the site

Just a short update - not sure if this is significant in any way:

When I install File (Field) Paths module the node tokens do reappear for file fields (only) but disappear right away again after disabling the module.

Update: adding the very same field to e.g. profile2 type makes it appear as a token too under "current user" tokens. There just seems to be no way for me to make a field available as a node token.

dynamicdan’s picture

Title: "Nodes" tokens gone on some parts of the site » Node tokens not available as expected (image fields etc.)
Component: Miscellaneous » Code

I don't see any node tokens when editing a an 'image' (File/image) field.
I'm not sure if this is simply a lack of token support from the node or image modules.

I want to use [node:source:source:author:uid] (or perhaps [node:author:uid]) as part of the save path for files. This would help me nicely group uploads by user id.

jtassin’s picture

I have come across this issue as well when trying to setup a trigger for comments. Trying to send a email using [node:author:mail] and it won't resolve at all. Logs say: invalid email [node:author:mail]

dynamicdan’s picture

Version: 7.x-1.3 » 7.x-1.x-dev
Priority: Normal » Major

Lets see if we can get some attention here.

zmove’s picture

Subscribe. I can't find any token related to the node author on an image field for example (to define path). It's weird to have a so small issue queue as this kind of need seems very common to me.

dave reid’s picture

Category: bug » support
Status: Active » Fixed

This is a limitation of Drupal core - it does not provide any node context for token replacement aside from the global tokens that are available. You will need a module like http://drupal.org/project/filefield_paths in order to use node tokens in the file upload directory tokens.

I have come across this issue as well when trying to setup a trigger for comments. Trying to send a email using [node:author:mail] and it won't resolve at all. Logs say: invalid email [node:author:mail]

You need to use tokens like [comment:node:author:mail]. An action for comments has a comment context only, not a node context.

dave reid’s picture

For Meta tags, make sure you upgrade to the latest release of Token. The 7.x-1.3 version contained a bug that made token contexts disappear in the modal dialog.

dynamicdan’s picture

Category: support » bug
Status: Fixed » Active

There is a test in drupal core to support node:author so I don't see how drupal core is limited. Are you saying this test should also be present in the file.test ?

node.test:2303

$tests['[node:author]'] = check_plain(format_username($account));
gagarine’s picture

Version: 7.x-1.x-dev » 8.x-1.x-dev
Issue summary: View changes

This is still present in D8.

gagarine’s picture

Title: Node tokens not available as expected (image fields etc.) » Node tokens are not available fields settings (image path, ...)
gagarine’s picture

Title: Node tokens are not available fields settings (image path, ...) » Node tokens are not available in fields settings (image path, ...)
gagarine’s picture

Issue summary: View changes
sassafrass’s picture

I am using D8.3.5 and trying to enter tokens in the link URL field. Although the node tokens are available, they are interpreted literally. For example, /node/[node:nid] or [node:url:path], result in /node/[node:nid] or /[node:url:path] respectively. As opposed to the expected /node/1 or /my-alias.

berdir’s picture

Title: Node tokens are not available in fields settings (image path, ...) » Node tokens not available as expected (image fields etc.)
Category: Bug report » Support request
Status: Active » Fixed

This should have been left closed years ago.

As explained above, you can not use tokens everywhere and whoever calls token replace needs to provide the necessary context.

@sassafrass: If you haven't found a solution for what you are trying to do, I'd suggest asking on Drupal Answers or another support channel, you can not use tokens in links, that's just not possible.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.

rgnyldz’s picture

For those who stumble on this there is a path token where we could get the node id under Current page > URL > Unaliased URL > Arguments

[current-page:url:unaliased:args:1]

The specific argument of the current page (e.g. 'arg:1' on the page 'node/1' returns '1').