4

I'd like to ask a question concerning the Views field view module.

I can see in the parent view a list of tokens available to pass as arguments to the child view but I can't see any way to grab those arguments from within the child view.

How can I achieve this?

4

The recieving end doesn't require any configuration that's specific to Views field view. The arguments are passed on as if they came from the URL, so they are used just like regular arguments/contextual filters.

It's important to note that it's easy to completely wreak your server performance with this module. A medium-sized site could suddently execute a thousand views or so if this module is (ab)used.

| improve this answer | |
  • I don't quite get it, If i want to define - in the child view - a filter criterion like: Taxonomy term name | Is equal to (=) | [Token received from 'above'] how would i go about doing that? – magtak Jan 17 '12 at 10:20
  • In short, you can't do it that way. I believe you first need to read the docs on what a "Argument" (D6) or "Contextual filter" (D7), is, and my answer will make more sense to you. – Letharion Jan 17 '12 at 10:23
  • did it btw happened "automagically" once i set a contextual filter. yay! – magtak Jan 18 '12 at 14:23
  • Great, glad it worked out for you. :) Added an extra note to the answer above. – Letharion Jan 18 '12 at 15:02
  • Figured as it's query in a query (in a query in a query ... etc). But I use it with sense. Thanks. – magtak Jan 19 '12 at 7:56
2

As I had a lot of trouble setting context filters properly for Views Field View, and couldn't find any documentation on the subject or proper answers, I'll provide more detailed walk-through here:

I want to have a list generated like this from different content types:

  • First group of things
  • Some data about that group

    • name of first thing from that group
    • name of second thing from that group
  • Second group of things

  • Some data about that second group

    • name of first thing from the second group
    • name of second thing from the second group

  1. I've created parent view "my_group_of_things" showing fields from content type "my_group"
  2. I've created child view "list of things" showing fields from content type "thing"
  3. The content type "thing" has a field ("field_my_group") of type node reference that references to selected "my_group" and has a label "Content: MyGroup"
  4. In parent view ("my_group_of_things") I add field Content: Nid
  5. In the same parent view I add field Content: View and set it to "list of things"
  6. While setting the Content: View field I enter [!nid] in the CONTEXTUAL FILTER text box
  7. Don't forget to apply the Content: View and save the View
  8. In child view ("list of things"), in ADVANCED tab, I add a CONTEXTUAL FILTER
  9. While setting this contextual filter I choose Content: MyGroup (field_my_group)
  10. In the same contextual filter I set WHEN THE FILTER VALUE IS NOT AVAILABLE to "Hide view"
  11. Apply and save. It should work now.

Very simple, but without documentation and arrogant answers like "yeah, i got it now", or "just set up contextual filter" it took me a whole day to figure out.

| improve this answer | |
  • This doesn't really answer the question, which is "I can see in the parent view a list of tokens available to pass as arguments to the child view but I can't see any way to grab those arguments from within the child view." The answer is the already accepted one. – kiamlaluno Feb 21 '14 at 4:09
  • Wojtek, you the man! – user219492 Apr 4 '14 at 7:15

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.