0

I've been stuck on this all day and I need help.

I have a video node that has a relationship (node reference) with a playlist node.

There are multiple videos referencing that playlist and there are multiple playlists.

Now here is my issue...

I have my node that plays my video and a view that lists all other videos in the same playlist to the bottom of the node. The views display plugin i'm using is EVA: Entity Views Attachment. This works apart form the fact I don't know now to filter it to only show a list of videos that are in the same playlist (referencing the same playlist node). I am able to get the ID or tokens (eg: field_video_playlist) from the video node and pass as an argument but when I setup contextual filter and relationships in the EVA view it returns nothing.

Without the contextual filter and relationship in the view it returns ALL videos.

Any help with this would be very much appreciated.

C

1
  • Have you tried to add a value (nid for example) to that contextual filter manually ? If yes and it didn't work it's more possible that something is wrong with your query,ie your contextual filters or relationships. – mchar May 13 '16 at 12:50
1
+50

Start with a view that lists Content of type video.

In the ENTITY CONTENT SETTINGS use:

Entity type: Node
Bundles: Video
Arguments: Use the ID of the entity the view is attached to.

This adds the EVA field to all nodes of type Video and provide the node id to Views. I suppose you have gotten about this far.

Now add a contextual filter to the View, and choose the Content: nid. This value will be populated by EVA as just specified in the arguments. This makes the view aware of the node we are currently viewing. If you want to hide the current node from the playlist, you can select exclude hidden behind the more fieldgroup.

Then add a relationships from the playlist back to the video called Entity Reference: Referencing entity.

This includes all other video nodes associated with the same playlist in the view.

Preview

As you can see in my preview, when I view Video 1 (node id 2 because 1 was for the playlist), I see the other 2 videos in the playlist (I chose to hide the current node in the contextual filter).

If you DO want to include the current video in the view (you left exclude unchecked) it becomes a bit more complicated as you will need to use an extra relation: Entity Reference: Referenced entity. Then alter the other reference to use the reference of this one (you might have to change the order).

Then make sure all your fields and filter make use of the last relationship, so they display the title of the attached nodes and not the title of the initial node. It should look something like this:

Screenshot 2

14
  • Thanks @Neograph734 - I'm still struggling with this. Any chance you can expand on your instructions. I must be doing something wrong. – cybercampbell May 13 '16 at 3:24
  • @cybercampbell Can you update the question with one or more screenshots of the Views configuration? It is kinda hard to guess what part you missed ;) – Neograph734 May 13 '16 at 8:51
  • I tried loads of variation but took them out. Right now showing all is better than showing none as the site is live. I just not clear on a few of the instructions. Are points 1 & 2 instructions or comments on what to do? – cybercampbell May 13 '16 at 11:14
  • 1
    I had a spare moment. It was actually less complicated than I rememberred. More detailed description and screenshot attached. – Neograph734 May 13 '16 at 14:00
  • 1
    Probably at the start. You should create a view of content (nodes). Just start over. Since you are using node reference, you should use those equivalent relations instead. (I assumed you used the entity reference module.) Just create one relation from video node to the playlist node, and a reversed one from the playlist back to the video. – Neograph734 May 13 '16 at 16:06

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.