I have recently run into a lot of use-cases where I would like to pass node reference nids to a viewfield in order to pull in field data for a given node. I can manage this by doing some views override code, but it's kind of clunky. It looks like this issue has come up some time ago: http://drupal.org/node/230867 <- also, no good path described there. It'd be nicer for me to have this baked-in - less of my own code to upgrade down the road.

So it makes sense to me to simply offer a node reference selector in the field settings that allows users to set a given node reference field's nids as the argument for a given viewfield. So, through something together this afternoon to show how it might work.

Thoughts?

Thanks.

CommentFileSizeAuthor
support-nodereferences.patch3.82 KBcfennell
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

danielb’s picture

Related but different drupal version #1350916: Node reference Argument

My thoughts is this is the sort of thing if you implement you could be implementing all kinda of ways to fill arguments in.

I believe a better solution is to supply the nid as an argument, and have the view do the legwork in converting that to the node references for it's purposes. I think this is already possible, I know you could do it with Views argument handling code, and there may be a handler for it available too.

edit: oh you know that already, well I think that's the best way anyway, views has a lot of flexibility so stuff like that is possible.

sashkernel’s picture

Can you elaborate more on how to do this for those who are not that experienced?

sashkernel’s picture

Got it figured out.
It's actually very simple.
1. when view field is setup within the content it has already a field to pass an argument, so I put my [node:nid] in there
2. in a view I setup a contextual filter which included a Node Reference field which referenced to the node in step 1.
everything started to work right away.

Thanks for a great module.

sashkernel’s picture

Version: 6.x-2.x-dev » 7.x-2.0
Issue summary: View changes
Status: Active » Closed (works as designed)