Closed (fixed)
Project:
View reference
Version:
7.x-3.2
Component:
User interface
Priority:
Normal
Category:
Support request
Assigned:
Unassigned
Reporter:
Created:
24 Jan 2012 at 00:05 UTC
Updated:
4 Mar 2012 at 08:30 UTC
I have a view that uses a few contextual filters and I want to pass an argument to each filter. I don't want to pass multiple arguments to one filter, but one argument to each, via URL. So in the case where there are two filters each accepting one argument, the URL would look like this:
The view itself works if I pass the arguments /drupal/node/nodeNumber/arg1/arg2 where arg1 and arg2 are the arguments I want to pass, and nodeNumber is the number of the node that contains the view reference.
I tried entering arg1/arg2 in the edit form of the node but it didn't work.
Comments
Comment #1
danielb commentedMate I have no idea. When you execute a view programmatically it provides an option to pass in arguments for the view. So that is supported through this module's interface. I have no idea about the configuration of your view or how it works.
In my experience this has been pretty straight forward to use, but I've never had multiple contextual filters.
Comment #2
Juryiel commentedWell, the view works by passing arguments in a standard way:
e.g. if I pass in the argument 15/Name in the url or in the view preview it will send the argument 15 to the first contextual filter, and the argument Name to the second contextual filter. This works in the view.
If I type 15 in the module field during node edit, the single argument is passed correctly. If I type 15/Name in the edit form, then the two arguments are not passed correctly. Are you saying that the module can't do that, or am I doing something wrong?
Comment #3
Juryiel commentedOops, forgot to change status. If the module can't do this consider changing it to a feature request.
Comment #4
danielb commentedAlright I found out some more info about this.
There is some useful code in http://drupalcontrib.org/api/drupal/contributions%21views%21includes%21a...
which might fix this.
Comment #5
Juryiel commentedUnfortunately I'm not much for complicated code.
In the case of multiple view references on one node that only differ by one contextual argument while all other arguments that are passed are the same (e.g. 5 view reference fields, first argument is different for each view reference, but all others are the same for all view reference fields) there is a workaround, which is to set the view itself to grab a raw argument from the URL position you specify when no argument is provided, then just provide only the first unique argument in the edit form, and the rest of the common arguments in the URL positions specified. This works for my purposes, as only one of my arguments was different between the different view references on the node, while other arguments were common to all the view references.
However, this still doesn't take care of the issue when you might need more than one contextual filters each with a unique value per view reference on a node, which may be an issue for someone else.
Comment #6
danielb commentedI've added some of the code from that function I linked to this module. The changes will appear in the next dev snapshot (check the date is after this posting).
I don't know if it will automatically fix the problem though.
Comment #7
danielb commentedComment #8
danielb commentedJuryiel reopen if you wanna go through this any further.