Quantcast
Channel: Issues for Drupal core
Viewing all articles
Browse latest Browse all 313910

Get the nid of the current edit page for an Entity Reference View?

$
0
0

I've got two content types. Let's call them X and Y.

X has an entity reference field, pointing to nodes of content type Y. If I use the default view, things seem to work fine.

I then want to create an interesting/complex entity reference view that works from the edit page for a node of type X (e.g. /node/1234/edit), that takes the nid of the current node (i.e. 1234) as uses it in a parameter for the view.

My entity reference view works just fine. I manually enter the contextual filter in the view (i.e. 1234) and the results are exactly as I expect.

However, I can't seem to figure out setting up the Contextual Filter so that this works within /node/1234/edit.

I've tried the following:

Content: ID. When the Filter Value is not available: Provide Default Value: Content ID from URL

Content: ID. When the Filter Value is not available: Provide Default Value: Raw value from URL (Path Component 2)

Neither seems to work. Within the entity reference field on /node/1234/edit, no results are returned. If I disable this Contextual Filter. (i.e. set "Display all results for the specified field"), the view works fine on the node edit page.

Any ideas what I'm doing wrong here? Any ideas on how I can help diagnose it (return the value that contextual filter is seeing in the entity reference result?)

Thanks in advance!


Viewing all articles
Browse latest Browse all 313910

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>