Hmm. I'm trying to configure the field widget to use a view, but the second argument is not passed to the view.

I want to use this to select advertisements based on their orientation (square, wide, tall). I have a field that needs to pass the arguments "square,tall", but the autocomplete is only showing me the square advertisements. If I reverse the arguments to "tall,square" it shows me the tall ads.

The problem appears to be that the widget arguments field is adding a space after each comma on save - "square, tall". This does not work when used in the Views preview UI either.

Latest dev.


John Pitcairn’s picture

Title: Autocomplete widget views filter does not receive more than one argument » Allow views select widget to pass multi-value arguments

Arrrgh, slapping my forehead ... I actually need a single argument that allows multiple values, ie "a,b,c", not a/b/c. It was a very late night.

So, changing the title ... can the widget please use an argument delimiter that is not also used to delimit argument values by views contextual filters?


GiorgosK’s picture

I confirm
single value argument works inputting more values does not

nithinkolekar’s picture

I was looking for the same. Made the small changes to EntityReference_SelectionHandler_Views.class.php.
Now you can pass argument just like 1,2,3 (AND) and 1+2+3(OR).

#line 54 
$default = !empty($view_settings['args']) ? implode(', ', $view_settings['args']) : '';
$default = !empty($view_settings['args']) ? implode(';', $view_settings['args']) : '';
#line 60
'#description' => t('Provide a comma separated list of arguments to pass to the view.'),
'#description' => t('Provide a list of arguments to pass to the view seperated by semicolon.'),
#line 188
$args = array_map('trim', explode(',', $args_string));
$args = array_map('trim', explode(';', $args_string));

Feature Request:
If view is configured to filter based on taxonomy,node or anything else, then view argument should be autocomplete widget that should pass respective data(s) as filter.

John Pitcairn’s picture

Well, yeah, but looking at this again, I wonder why this shouldn't simply be using the views native delimiter - a forward-slash. So you'd enter multiple arguments exactly as you would in a path or views preview: arg1/arg2/3,4,5/51+64.

tim.plunkett’s picture

I came across this problem while using "Content: Type" as a contextual filter.

Except it turns out, if your contextual filter is a string, it completely ignores the difference between '+' and ','.
It will end up as either '=' or 'IN' based on the number of them.

So, when I tried to do 'event,article,blog' and had it being split into 3 arguments, I only needed to use 'event+article+blog' and it worked fine.