I need to create a nested view basically. I have a content type with some fields and it can reference another instance of the same content type (0-N). And the second level node can again reference 0-N another instances of the same content type and so on.
It works for the second level, I can reference 2 nodes from the first level and it works well. BUT in the third level, it all goes wrong. Wrong argument is passed and the third level just references the second level's nodes again.
For example, if I have four nodes, where 1 references 2 and 3; and 3 references 4, I should get 1 in the first level, 2 and 3 in the second level and 4 in the third level, but I acutally get 1 in the first level, 2 and 3 in the second (so far so good) but then 2 and 3 again in the third level. It seems to work in the view admin page, but it doesn't work in the view itself.
Does anybody have the same problem?
Thanks a lot.
| Comment | File | Size | Author |
|---|---|---|---|
| #2 | viewfield_2972067.patch | 1.01 KB | marysmech |
Comments
Comment #2
marysmech commentedI have been debugging it and I think that is caused by used method of views rendering. Attached patch use
views_embed_view()to render views and it seem to render correctly all levels.Comment #3
marysmech commentedComment #4
khalor commentedCleanly applies, works well for me!
Comment #5
jerdavisI'm not on board with breaking up the structured approach and just calling view_embed_view. The code path ultimately follows the same code that's included in view_embed_view, so I'd rather approach this and resolve it more discretely.
Before I can reproduce this issue and understand what the source issue is, I need to better understand the example use case. Could you please outline your configuration in more detail? What are your content type and field configurations? Can you provide a more detailed example scenario and/or screenshots of the configuration and desired output?
Based on my understanding of the example you already provided, If you are dealing with entity references and wanting to show the referenced pages and sub pages, would it make more sense to simply use the display formatter for the entity reference field rather than a view?
Comment #6
jerdavisComment #7
jerdavisPlease provide a generic, reproducable config example.
Comment #8
maxilein commentedI had a similar issue - accidentally also on the 3rd level ... but I realized that the passing of the view parameter to the nested view does not work, if you set the output format of the NID (ID field) to something other than default.