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.
Hi,
Thanks for this module, it is proving very usefull!
I did find a bug I think: when using multiple range widget, all of the 'to' and 'from' values become identical. I looked into the global_filter_create_range_widget and saw that all range values are saved as 'to' and 'from' in the form state, so it doesn't seem to able to support multiple widgets.
var_dump($form_state);
'input' =>
array
'form_build_id' => string 'form-SChBN-O37PXVAMqtFU4THtAeZ98OWu7rABBCmzAxdtY' (length=48)
'form_token' => string 'qYvtydnmKZPqX_Dvc36yUGR5r1wJzOwkQX1SFR1JfAg' (length=43)
'form_id' => string 'global_filter_1' (length=15)
'field_boutgaten' => string '120' (length=3)
'field_pcd' => string '' (length=0)
'from' => string '56' (length=2)
'to' => string '58' (length=2)
'view_cars' => string '' (length=0)
'op' => string 'Set' (length=3)
I think it would be best to prefix the 'to' and 'from' values with their field name, so that no mixups can happen. Someting like:
'input' =>
array
'form_build_id' => string 'form-SChBN-O37PXVAMqtFU4THtAeZ98OWu7rABBCmzAxdtY' (length=48)
'form_token' => string 'qYvtydnmKZPqX_Dvc36yUGR5r1wJzOwkQX1SFR1JfAg' (length=43)
'form_id' => string 'global_filter_1' (length=15)
'field_boutgaten' => string '120' (length=3)
'field_pcd' => string '' (length=0)
'field_1_from' => string '56' (length=2)
'field_1_to' => string '58' (length=2)
'field_2_from' => string '30' (length=2)
'field_2_to' => string '50' (length=2)
'view_cars' => string '' (length=0)
'op' => string 'Set' (length=3)
I'll see if I can fix this myself and then I'll submit a patch.
Comment | File | Size | Author |
---|---|---|---|
#1 | global_filter_multiple_ranges2.patch | 2.5 KB | K3vin_nl |
Comments
Comment #1
K3vin_nl CreditAttribution: K3vin_nl commentedOk, I think I found a fix. I changed al all of the ['to'] and ['from'] values to ['field_name_to'] and ['field_name_from'].
Attached is a patch. I temporary disabled the validation, because I haven't rewritten that yet.
Comment #2
RdeBoerThanks K3vin!
I looked at your patch and was wondering: will your patch still work for the simple case of 1 range widget?
Rik
Comment #3
K3vin_nl CreditAttribution: K3vin_nl commentedI just did a quick test and it also works with just one range widget. Is there any reason this shouldn't work that I might have missed?
Comment #4
RdeBoer@K3vin, #3
On closer inspection, no...
Patch applied with attribution.
Validation added.
Thanks Kevin.
Rik