Hello!
I faced a small problem with Views Field View module. I use Global: view field to insert a view with 5 argements, one of which is configured to allow multiple values, which means that users can enter multiple values in the form of 1+2+3 (for OR) or 1,2,3 (for AND). Therefore I used the following text as Contextual filters: "all,all,[%nid]+[%nid_1],all,all" (). But Views Field View module doesn't return correct view. One interesting moment. When I write "all,all,4731+4732,all,all" instead of the previous text the module returns correct results. It looks like a bug. Please fix it.

Comments

Norberto Ostallo’s picture

Version: 7.x-1.0 » 7.x-1.x-dev
Component: Miscellaneous » Code
Status: Active » Needs review

The problem is caused by the way the module replaces token values in function get_token_value in file views_field_view_handler_field_view.inc.
I solved this problem by adding recursion at the beginning of the function, allowing a single view argument containing multiple tokens to be replaced multiple times when tokens are separated by '+'.

function get_token_value($token, $values, $view) {
    // Handle multiple tokens for a single argument.
    if (strpos($token,'+') !== false) {
      $value = array();
      $token_array = explode('+', $token);
      foreach ($token_array as $token_item) {
        $value[] = $this->get_token_value($token_item, $values, $view);
      }
      return implode('+', $value);
    }
    
    $token_info = $this->get_token_argument($token);
    $arg = $token_info['arg'];
    $token_type = $token_info['type'];
milos.kroulik’s picture

Issue summary: View changes

This doesn't work for me, embedded view is still empty. Any idea how can i debug this?

I can also confirm, that filtering works if filter values are inserted directly into the field instead of using field tokens.

siva.thanush’s picture

Where the above code must be replaced?
Can you suggest if you have anyother options?
I have two terms exposed in main view.
I need to pass two arguments in the views field views and make it work.
When i passes multiple agruments like [!tid],[!tid_1] (Say tid is 123 and tid1 is 456).

And wheni passed 1,4
the result displayed is

1,4
1,5
1,4
1,6
etc.,
How do i make it like

1,4
1,4
...
...
...

bmango’s picture

I can confirm that the code update in #1 works great! Many thanks!

bmango’s picture

Status: Needs review » Reviewed & tested by the community