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.
I have the views version from 08 March 2011.
In my view I have a filter based on an list named "field_kaz_options" with possible options 1, 2 and 3.
Now I cannot check this options anymore like in the versions before.
In the query he take this filter with LIKE
SELECT node.nid AS nid, node.title AS node_title, field_data_field_standort.field_standort_postcode AS field_data_field_standort_field_standort_postcode, field_data_field_standort.field_standort_city AS field_data_field_standort_field_standort_city, node.created AS node_created, 'node' AS field_data_field_kaz_image_node_entity_type, 'node' AS field_data_body_node_entity_type, 'node' AS field_data_field_preis_node_entity_type, 'node' AS field_data_field_kaz_options_node_entity_type
FROM
{node} node
LEFT JOIN {field_data_field_parked} field_data_field_parked ON node.nid = field_data_field_parked.entity_id AND (field_data_field_parked.entity_type = :views_join_condition_0 AND field_data_field_parked.deleted = :views_join_condition_1)
LEFT JOIN {field_data_field_kaz_options} field_data_field_kaz_options ON node.nid = field_data_field_kaz_options.entity_id AND (field_data_field_kaz_options.entity_type = :views_join_condition_2 AND field_data_field_kaz_options.deleted = :views_join_condition_3)
LEFT JOIN {field_data_field_standort} field_data_field_standort ON node.nid = field_data_field_standort.entity_id AND (field_data_field_standort.entity_type = :views_join_condition_4 AND field_data_field_standort.deleted = :views_join_condition_5)
WHERE (( (node.type IN ('announce')) AND (node.status = '1') AND (field_data_field_parked.field_parked_value = '0') AND (field_data_field_kaz_options.field_kaz_options_value NOT LIKE '2' ESCAPE '\\') ))
GROUP BY nid
ORDER BY node_created DESC
LIMIT 20 OFFSET 0
Comment | File | Size | Author |
---|---|---|---|
#10 | 1086158-filter-list-2.patch | 845 bytes | dawehner |
#10 | 1086158-filter-list.patch | 1012 bytes | dawehner |
#7 | 1086158-filter-list.patch | 952 bytes | dawehner |
#6 | sreenshot_views_1.jpg | 21.22 KB | klaus66 |
Comments
Comment #1
dawehnerCan you please remove and add the filter again?
This should fix the problem.
Comment #2
klaus66 CreditAttribution: klaus66 commentedI have tried this but it doesn't work. Always the textfield and not the checkboxes in the UI.
I tested it with all my listfields and always the same result.
Comment #3
dawehnerDid you cleared the views cache on admin/structure/views/tools?
There might be problems there
Comment #4
klaus66 CreditAttribution: klaus66 commentedOf course I did.
Comment #5
bojanz CreditAttribution: bojanz commentedI reproduced this.
git blame says it's caused by commit:
#1079496 by dereine: Fix renamed field names for list fields. This caused an additional filter, which didn't worked.
The wrong handler gets chosen, not the filter_list one.
Which means that this code is failing:
As far as I can see, that IF can never be true, since $field_name will always be in_array ;)
Comment #6
klaus66 CreditAttribution: klaus66 commentedHere is a screenshot
Comment #7
dawehnerSorry sorry sorry.
Perhaps i should wait weeks to commit patches again.
Comment #8
klaus66 CreditAttribution: klaus66 commentedI have applied the patch and the listfilter works but I get the following notices (20 or more):
Comment #9
dawehnerSo needs work.
Comment #10
dawehnerLet's try two differnent approaches.
It would be cool if you could try the second one as well. This is slightly more advanced/safe's some code but needs extra review
Comment #11
klaus66 CreditAttribution: klaus66 commentedI applied the 1086158-filter-list-2.patch. I have done a short test with different list fields and I get no errors or notices.
I have an older views dev version on another server and there the function looks this and it works too:
Comment #12
dawehnerThe old code doesn't help, too :)
Please test the first patch, too.
Comment #13
klaus66 CreditAttribution: klaus66 commentedI have tested now the first patch and it also works.
Comment #14
dawehnerThanks for testing the patch!
Commited the second one and pushed it.