I have a view that is using the module 'views between dates filter' https://www.drupal.org/project/views_between_dates_filter as a secondary option. This provides start and end date fields.
When I submit the search and there with no search terms and the secondary options closed the secondary options are open when displaying the results.
This appears to be in the function 'exposed_form_alter' in 'better_exposed_filters_exposed_form_plugin.inc', in particular the following code.
if (!empty($exposed_input[$filter->options['expose']['identifier']]) && $settings[$label]['more_options']['is_secondary']) {
$secondary_collapse = FALSE;
break;
}
It looks to me like the problem is caused by $exposed_input[$filter->options['expose']['identifier']] not being empty when no values have been submitted because unlike a normal filter it contains an array with two values and .
Instead of being empty the contents of $exposed_input[$filter->options['expose']['identifier']] looks to be as follows
field_date_value (Array, 2 elements)
--min (Array, 1 element)
----date (String, 0 characters )
--max (Array, 1 element)
----date (String, 0 characters )
I've also checked dates with an equals operator and this also fails in a similar way. In this case the value of $exposed_input[$filter->options['expose']['identifier']] is
field_date_value (Array, 1 element)
--value (Array, 1 element)
----date (String, 0 characters )
Would you be happy looking at adding a check for a date filter?
Comments
Comment #1
Ollie222 CreditAttribution: Ollie222 commentedI'm not setup for rolling this as a patch or if this is the most generic way of doing this however changing the following code looks to fix the problem for me.
Old code
New code
Comment #2
rodpal CreditAttribution: rodpal commentedThat didn't work form me. This is what I ended up doing:
Comment #3
cimo75 CreditAttribution: cimo75 commentedSame problem here .
Comment #4
Neslee Canil PintoHi, there will be no more future development for 7.x branch. If you see this issue in 8.x, feel free to file an issue. Closing this as Closed(wont fix).