0

I try to create a view with NID argument and embedd inside as a field another view with totally ditfferent argument. I used module called views_field_view but it seems that parent view is passing arguments to child view, which cause to break arguments on child view- that is what I do not want. Is it possible to do such combination? Thank you

What I try to do: I try for days to come up with some decent solution to this problem: On each node there is a multivalue field (field_ref) for referrencing 2 nodes (can be left empty as well). Also each node contains another field for (field_par) referrencing parent node. Moreover, each node has taxonomy term.
Now, on current node NID I need to display referenced nodes from field_ref. If the field is empty I need to display the values from the same field - but this time from a node that is referrenced in field_par on current node. If this field is empty, it should display values of the same field but from field_par of the parent node etc. until the node with top term is reached.

My solution was fairly simple - Argument - Content: Has taxonomy term ID (with depth) set to minus values so I get all terms all the way up. Add relationship to field_ref and connect it with fields - for example title. This way I get all results coming from parent nodes with higher taxonomy terms. Then I restrict results only to 2 results and add sorting according to custom integer field that I created on taxonomy terms according their depth (currently there is no other way to sort terms according to their depth) And that is it.

Problem with this solution is that I am not able to get inside current node values because adding another argument like NID breaks functionality of taxonomy argument.

I was also proposed another solution: to add NID as main argument and to get values from parent nodes using combined relationship : Content: Taxonomy terms on node + Taxonomy term: Parent term + Taxonomy term: Content with term. Which works ok but this view is static.

Finally what came to my mind was to combine view with my solution as a field inside a view with NID argument. So that the main view would display current node fields and if empty, it would display the field with embeded view refults. But maybe the solution can be much simpler and I am overcomplicating it:)

2
  • It could be helpful to understand why the inner view doesn't share arguments with the outer view, or how the two are connected.
    – Letharion
    Apr 27, 2013 at 13:03
  • @Letharion I updated my question to provide more info
    – loparr
    Apr 27, 2013 at 14:00

2 Answers 2

0

I can't immediately think of a simple solution to this problem, but I also don't have VFV installed anywhere, so I can't play around with it at the moment.

What I would probably have done, is created a ctools content type, called both of the views, and manually rendered through a specific template afterwards. This solution however is non-trivial, so perhaps you will need to search for a different one.

See What are Ctools plugin (content type, access, etc), and how does one create them? for info on implementing ctools content types.

Example of adding a specific template on top: Correct way to render a modules output through a template?

0

Finally I decided to go slightly different route - there is a setting in advanced tab in views - no results behaviour, which allows you to embed an existing view with it's own arguments.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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