I am trying to embed a view using a php snippet, and then set the values of exposed filters, using the method explained here: http://groups.drupal.org/node/10129
I am using the following code and it works perfectly for exposed filters that only allow only a single selection.
<?php
$view = views_get_view('view_name');
$view->set_exposed_input(array('filter_name' => '10'));
print $view->preview('default');
?>
But, this code will only work for single-option filters (i.e. when "Force single" is checked on the filter options). I also want to be able to set values for filters that allow more than one selection. Can anyone help with a code snippet that would work to set the value(s) of exposed filters that allow multiple options?
Thanks!
Comments
Comment #1
nancydruI have pretty much the same situation with specifying the option value in the URL. It works fine on all the single choice filters, but not on the one multi-choice filter unless I set it to "Force single" which the customer doesn't want.
Comment #2
merlinofchaos commentedMulti-value filters need to have their values set as an array.
i.e
Is that your problem?
Comment #3
nancydruThank you, Earl. Also, in URLs, I see they need brackets (
?geo[]=76).Comment #4
merlinofchaos commentedIn a url ?geo[] = 76&geo[]=77 means: geo = array(76, 77) in PHP.
(Or more likely:
Comment #4.0
merlinofchaos commentedcorrecting typo
Comment #5
mustanggb commented