Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Since the v7.x-2.9 release cycle the exposed filters have automatically assigned a value, even when one is not requested.
The bug was introduced in #2309015: views date field exposed filter default value not being added in $form_state['input'] when initially views loads.
Comment | File | Size | Author |
---|---|---|---|
#1 | date-remove-unneeded-default-2420323-1.patch | 1.21 KB | Michelle |
Comments
Comment #1
MichelleIn #2309015: views date field exposed filter default value not being added in $form_state['input'] when initially views loads there are two patches. The second patch adds on code to the first patch with the note that the first patch caused a fatal error. However, the code in the second patch is setting a default value where it shouldn't be. When I tried removing that code entirely, I didn't get any errors so I couldn't figure out what the additional code was trying to fix. Instead of removing it completely, though, this patch keeps the part of the code that initializes the array elements but sets them to NULL rather than today's date. Later on in the code, outside of the patched part, it is correctly setting the value to the default chosen in the Views UI.
Comment #2
DamienMcKennaComment #3
andrewbelcher CreditAttribution: andrewbelcher commentedThis appears to solve the issue for me. Filters without a default no longer have a default and filters with a default work correctly. I'm not going to mark as reviewed as I don't know the code well enough to know whether it will have other issues.
Comment #4
stefan.r CreditAttribution: stefan.r commentedPatch looks good. Upgrading priority as it can break existing views after a module upgrade.
Comment #6
vijaycs85Thanks all.