when you set view arguments to be passed to the selected view to display the nodes, the arguments are handled incorrectly in code leading to them being lost, patch included below

the view arguments are a comma separated string of arguments, the string is exploded into an array which is then concatenated to a string leading to the string having the value "Array"
as far as ive learned, the view_args should be an array of arguments, i am not sure why passing a string as an array's element [0] doesnt work in my case, if i just pass the string along, it works, but you wont be able to send multiple arguments and this should be FIXED if possible, i dont have time to dig on this right now so i would appreciate any advice

--- ./nodereference_explorer/includes/nodereference_explorer.views.class.inc       2009-09-19 07:37:13.000000000 +0000
+++ ./nodereference_explorer/includes/nodereference_explorer.views.class.inc    2009-09-19 11:12:28.000000000 +0000
@@ -56,7 +56,7 @@ class nodereference_explorer_views {
     if (!empty($this->field['advanced_view_args'])) {
       if (!empty($this->view_args)) //append to existing arguments
          $this->view_args .= ',';
-      $this->view_args .= explode(',', $this->field['advanced_view_args']);
+      $this->view_args .= $this->field['advanced_view_args'];

     }
   }

Comments

phayes’s picture

I can confirm that this patch at least makes arguments work for single cases. I banged my head against trying to get it to work with multiple arguments to no avail. I need to learn more about the views API.

abaddon’s picture

Assigned: Unassigned » abaddon

"..but you wont be able to send multiple argument..", yea that one is not fixed yet, if no one else steps out to fix it ill give it a shot the next weekend, i need to be sure on how the code interacts inside drupal to be able to do it properly

gnindl’s picture

Status: Needs review » Fixed
StatusFileSize
new1.44 KB

Multiple values per argument: Separate values by a "+" or ',' sign, e. g. for "Node:Nid" set views arguments like this "123+456+789" or "123,456,789"(three nids)

Multiple arguments: Separate by a slash "/", e. g. first "Node:Nid" and second "Node:Type" => "123+456/page"

Supporting multiple arguments is tricky because the function views_embed_view() accepts only single arguments, not arrays! Now there is an ugly manual hack supporting 20 multiple arguments which should be sufficient for the most use cases;

abaddon’s picture

Status: Fixed » Needs work

this should really be marked as needs work, if someone has the time to look over it should be an easy one, im also not sure on the security implications of using uninitialized $arg_ variables for views_embed_view(), combined with register globals might blow

gnindl’s picture

Version: 6.x-1.1-beta6 » 6.x-1.x-dev
Status: Needs work » Needs review
StatusFileSize
new1.78 KB

With this patch the function views_embed_view() is called by name. Therefore all arguments can be passed as an array which s#hould fix the security issues of #3.

gnindl’s picture

Version: 6.x-1.x-dev » 6.x-1.1-rc1
Assigned: abaddon » gnindl
Status: Needs review » Fixed

Patch included in this release candidate.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.