Results 1 to 2 of 2
Mar 24, 2013, 08:02 #1
Consolodate 3 Views' Exposed Filters?
I'm using Drupal 7.x and I've created 3 views:
- A "mask" view that searches for users by fields I indicate (i.e. - searches for users by first, middle, and or last name instead of their usernames).
- An "internal contacts" view that outputs info about employees. This has an exposed filter.
- An "external contacts" view that outputs info about non-employees. This also has an exposed filter.
The last two views are used on the same page and due to their exposed filter forms, created 2 separate inputs that essentially do the same thing.
Here's what I want to do: I want to use only 1 form and use the mask view to key from for both of the 2 other views. Right now, both of the contact views are keying off of only the last name. Can I expose the the mask view's filter form and have that submit to the other two filter forms of the other two views? I still want those two contacts views' fields to be output on the page but I just need the form behavior to change...
So, long story short, I want "View A" to have an exposed form that submits its values to both of the other views. However, I need the other two views' data to be output like normal because they comprise the page's directory info.
Any ideas how to do this? I thought that I could somehow do the following:
1.) Use HOOK_form_alter() on the exposed form that the mask view will have and change the action to ___________ ? (I.e. - something that would allow me to pass in a contextual filter to the other two views?)
2.) In those other two views, configure them to accept a contextual filter that aligns with what the first view accepts but what the other two views accept as values.
This would allow the first two views to continue to output their data like normal on the page, but allow the first view to act as a bottle kneck filter of those views. Since HOOK_form_alter() would allow me to tie into a submit callback, I'm thinking this would be possible... It would be a perfect contacts directory.
Mar 24, 2013, 15:31 #2
Disregarding my misspellings, I found a solution:
1.) Downloaded the "Views Global Filter" module (with that Session Cache module).
2.) Activated both.
3.) Modified the internal and external contacts views to accept a contextual argument of type View, referencing the mask view in both and indicating that it's a default argument.
4.) Saved the views and went into the blocks area to use one of the global filter blocks and inside the configuration, indicated the mask view.
All-in-all, this is working. Now, the only issue I have is making the filter input perform a AND-OR selection of whatever it's provided. For example, providing the first and middle names only, etc. and still keying accordingly. I think the secret with this is how I have contextual arguments configured or else how I'm trying to use a global filter inside the filter settings... I dunno.