Set view arguments dynamically for the list of related content

jgumpert - November 13, 2008 - 02:34
Project:RelatedContent
Version:5.x-1.7
Component:Code
Category:feature request
Priority:normal
Assigned:Unassigned
Status:active
Description

I wanted to use a view for related content that would show a different list of nodes based on the value of a node reference for each node. The node reference in this case was for another node type that was used to group stories together. So I wanted to show related content that was some subset of the other stories in that grouping and I did not want to look at a list of all the hundreds of stories, just stories from that group. I think that view arguments are the best way to achieve this in general.

For this module, I found that I could make this happen by updating the calling of views_build_view in the functions _relatedcontent_form_view and _relatedcontent_track_finalize to look at the node, interrogate for the node reference and feed in that referenced 'nid' to the arguments array of views_build_view.

Is there a better way to achieve this functionality so that I don't need customize the module's code directly? Has anyone else done this?

 
 

Drupal is a registered trademark of Dries Buytaert.