Early Bird Registration for DrupalCon Portland 2024 is open! Register by 23:59 PST on 31 March 2024, to get $100 off your ticket.
Hi,
It doens't work with contextual filters is that by design?
tested 7.X -1.1, 1.2 en dev
greetz
Arjandew
UPDATE:
After some research i find this code on line 35 of views_autocomplete_filters.inc (version 7.x - 1.2)
$arguments[$k]['default_action'] = 'ignore';
I comment this line out and everything works fine. filters and contextual filters together! anybody know why this line is necessary
Comment | File | Size | Author |
---|---|---|---|
#21 | contextual_filter_2462861_21.patch | 5.4 KB | venugopp |
#15 | 2462861-15-interdiff.txt | 711 bytes | nvahalik |
#15 | 2462861-15-not_working_with_contextual_filters.patch | 3.47 KB | nvahalik |
Comments
Comment #1
vasikeActually it should work "by design.
Could you please provide more info about your case?
What about this issue : #2317351: Arguments not passed to filter when exposed as Content Pane ?
Comment #2
Arjandew CreditAttribution: Arjandew commentedComment #3
vasike#1871382-3: Autocomplete not taking arguments into account
This is the original isssue with the commit for this.
The autocomplete suggestions are the View (executed) results. So if we have some arguments / contextual filters with some settings other than "Display all values", probably there'll be no results or not the results we need.
So, actually, the autocomplete executes the view having ""Display all values" set for all arguments.
Does it make sense?
Comment #4
Arjandew CreditAttribution: Arjandew commentedBut you set a contextual filters with a reason.
I tested it with some use cases:
a normal view pages,
view embeded in a panels,
Filter form exposed as block,
Filter form not exposed as block.
a contextual filters with arguments set in panels,
a contextual filters display all results and with a default value.
a contextual filters with a default value set in views
I combined the test cases with normal filters,
on none of these testcases works a contextual filters, but when i remove the following line all the above testcases are working.
Comment #5
Arjandew CreditAttribution: Arjandew commentedAfter more tests i see that it still doesn't work. default value in views for contextual filters are working but not if you use input on pane config
Comment #6
Arjandew CreditAttribution: Arjandew commentedConclusion it is not possible to limit the results off the autocomplete suggestion based on contextual filter input on panel pane config..
Comment #7
Arjandew CreditAttribution: Arjandew commentedAnd found the problem it's working just fine you dont need to change any code.. the problem was 'expose form as block' if it is a yes it doesn't work when you change it to expose this form as block to no it work with contextual filters with input on pane config.
If anyone can confirm that contextual filter input on pane config with default value on the contextual filter = 'hide view' works but it stop working when you change expose form as block. this issue can be closed and we can open a new issue for the exposed block
thanks!
Comment #8
nvahalik CreditAttribution: nvahalik as a volunteer and commentedComment #9
nvahalik CreditAttribution: nvahalik as a volunteer and commentedThis patch adds the ability to use contextual filters as an option.
Comment #10
texas-bronius CreditAttribution: texas-bronius commented@nvahalik's simple patch in #9 works for me in my case: autocomplete was blindly returning all matchable items, but patch limits it down to the View's purview as the user would expect.
## Use case
Before:
A user types a partial, a list of items would show, user would select one and click Apply, and no results found.
After:
A user types a partial, a smaller list of items shows, user selects any one of them and clicks Apply, and all records matching that field are returned.
Comment #11
vasikeit seems the patch (#9) won't apply anymore.
@nvahalik: could you, please, reroll?
thank you
Comment #12
nvahalik CreditAttribution: nvahalik as a volunteer and at Code and Salt commentedRerolled on top of latest 7.x-1.x.
Comment #13
nvahalik CreditAttribution: nvahalik as a volunteer and at Code and Salt commentedComment #14
vasikestill not ready to be committed
We need an extra check for this setting for existing Views with autocomplete filters.
Notice: Undefined index: autocomplete_contextual in views_autocomplete_filter() (line 40 of /path_to_modules/views_autocomplete_filters/views_autocomplete_filters.inc).
So we need not to break somehow existing autocomplete filters.
Comment #15
nvahalik CreditAttribution: nvahalik as a volunteer and at Code and Salt commentedUpdated per #14.
Comment #16
nvahalik CreditAttribution: nvahalik as a volunteer and at Code and Salt commentedComment #17
nayanalok CreditAttribution: nayanalok commented#9 worked for me
Patch provided works very well for contextual filters.
Comment #18
scottsawyerThis is still a problem in D8.
Comment #19
jenlamptonPatch in #15 is RTBC for Drupal 7.
Comment #20
venugopp CreditAttribution: venugopp as a volunteer and at Moonraft Innovation Labs commentedHere is a similar patch for D8/9.
Comment #21
venugopp CreditAttribution: venugopp as a volunteer and at Moonraft Innovation Labs commentedHere is the updated D8/D9 patch for the latest version of the module(1.3)