0

I've got a content type called PartyGuest. That content type has an entity reference field for "Primary Guest", so if I'm inviting Bob and Jane to the party, Bob and Jane are both content nodes but I only want to send one invitation so I make Bob's "Primary Guest" value equal to Jane. That way I know that Bob should be included on Jane's invitation.

When I'm looking at Jane's node (or editing Jane's node), I would like to be able to see a list of everyone else who is on Jane's invitation.

I've created a View Block with a contextual filter so that it lists the names of all other PartyGuests where the Primary Guest is equal to the contextual filter value. That part works... sort of.

61 is Jane's nid. If I type "61" into the "Preview with Contextual Filters" box, then my results are exactly what I expect. It shows Bob in the list. However, if I change the Preview with Contextual Filters value to by "node/61" or "node/61/edit", then I get no results at all.

How do I make my context filter grab the value from the url?

I've set the Contextual Filter to provide a Default value and to pull it from the 2nd URL path component, but it doesn't seem to work. Even when I have it set this way, it only works if I put "61" into the Preview box, but does not work if I put "node/61" into the preview box.

enter image description here

I've also tried setting the Default value to be the Content Id from the URL with no luck.

What am I missing?

1

"Content Id from URL" is indeed what you want. The preview box doesn't care for the rest of the url (the /node/*/edit part) and takes everything entered there as an argument.

  • Yeah, it turned out that it wasn't behaving as expected in the Preview screen, but when I just saved and went to the real page it was working as expected. – Kenny Wyland Jan 29 '14 at 1:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.