Current page tokens not returning node ID from entity reference field view argument

Created on 28 August 2017, over 7 years ago
Updated 27 August 2024, 8 months ago

After setting up an entity reference field, for entity selection it uses an entity reference view. This entity selection sends a view argument using tokens.

If I send an argument manually instead of with tokens, it works fine and filters the entity reference fine.

However, using tokens instead of manually inserting data, the contextual filter fails to return any results.

It's possible that I'm misunderstanding some aspects of how the tokens are supposed to work. I have tried using [current-page:url:args:first], [current-page:url:args], [current-page:url:arg:1], [node:nid], and many more, but nothing returns results.

This is for a field with a single value. It should contextually filter such that while adding a new piece of content from a page X, the entity reference field only displays options matching X. For example, a user browses to content with ID 75, then adds new content. The contextual filter should receive the 75 value.

By the way, I have also tried providing a default value of content ID from URL in the contextual filter, and this too fails, in case that helps.

You can see some more details of my setup in the forums.

Am I missing or misunderstanding anything about how this should work?

Would you like any further information?

🐛 Bug report
Status

Active

Version

1.7

Component

Code

Created by

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024