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,
While reading this thread here: http://drupal.org/node/84286 I spotted a comment indicating that formstweaker might be extended to support modifying the exposed taxonomy filter widgets on views so that they appear as checkboxes/radios.
Has any progress been made in doing this ? Or does the current version do it and I'm simply being an idiot and not spotting how to enable it.
Regards
Jason
Comment | File | Size | Author |
---|---|---|---|
#5 | views_filters2checkboxes_0.patch | 2.53 KB | z.stolar |
#4 | views_filters2checkboxes.patch | 2.57 KB | z.stolar |
Comments
Comment #1
z.stolar CreditAttribution: z.stolar commentedI am also interested in such a solution and I'm currently researching towards it.
Since I was made co-maintainer of this module, I'll try to supply a new version of it, once I have a patch or something, or once someone else will supply one.
Comment #2
Jody LynnThis code is rather a mess, but it is working for me to replace exposed filter mulitple selects with checkboxes. I use it inside a hook_form_alter. Maybe it can help towards writting something more solid.
Comment #3
z.stolar CreditAttribution: z.stolar commentedThanks Lynn, I'll take a look at it and I'll try to integrate it into formtweaker.
Comment #4
z.stolar CreditAttribution: z.stolar commentedThis patch uses a development of what Lynn sent, to turn views filters into checkboxes and radio buttons.
It works in my environment, and I'd like to know if it works for you too.
TODO:
1. Use formtweaker's helper functions to modify the selects into checkboxes (currently it is all done inside form_alter).
2. Add a checkbox to views' exposed filters interface to select whether the filter should be rendered as select or as checkboxes.
I would also appreciate comments about the quality of the patch itself, as I am not very experienced with patching etc.
Comment #5
z.stolar CreditAttribution: z.stolar commentedThis patch shortens the former one, and adds the checkboxes/radio buttons capability to other than taxonomy widgets.
Comment #6
dpangier CreditAttribution: dpangier commentedThe line
if(isobject($form["filter$count"]['#options'][0]))
does not work correctly with taxonomies that don't return an item with a key of "0". I suggest:Comment #7
z.stolar CreditAttribution: z.stolar commentedYeah, I just ran into the same issue as well.
My solution was to check the first value for the ALL option:
It seems that your solution is better, cleaner, only the function name should be is_object (with an underscore).
I'll integrate it into CVS.
In any case, there is still one important thing to do before we create a new release with this feature, and that is to add the option in views exposed filters section. We need to let the user decide when to use checkboxes and when not to.
Comment #8
skor CreditAttribution: skor commentedSubscribing
Comment #9
scottrigbysubscibe - thx
Comment #10
nschelly CreditAttribution: nschelly commentedsubscribing...
-N
Comment #11
z.stolar CreditAttribution: z.stolar commentedIn the new 5.x-2.0 release I didn't include the views filters since we still hadn't have a way to decide on which filters exactly the form is to be tweaked or not.
Meanwhile, a new module has appeared which is doing exactly that (I haven't tested it yet): http://drupal.org/project/views_checkboxes
I see that it belongs to nschelly who subscribed here a while ago :-) .
@nschelly - Do you think it answers the needs here, and do you want to keep the modules apart or combine them?
Comment #12
scottrigbyThanks Neil & Zohar --
This seems to be a good solution, but there is an error that's happening. I would try to troubleshoot it, but my php skills are pretty larval.
Someone else already entered the issue and I commented here: http://drupal.org/node/192117#comment-630708
If anyone knows how to solve this (hopefully minor) issue, that would be great!
Comment #13
momper CreditAttribution: momper commentedsubscribing
Comment #14
z.stolar CreditAttribution: z.stolar commentedI think it should be discussed in the other module's issue queue.
Comment #15
nschelly CreditAttribution: nschelly commentedI will work on the errors in my own module, but I do still think the best place for this feature would be in this module. This module though was a little more complex than for me to presume knowing how you'd want to structure a fix.
-N
Comment #16
doublejosh CreditAttribution: doublejosh commentedHere is how I accomplished this in Views2. If you turn on AJAX the form will refresh the filter in place when clicking Go!!!
This is fairly one off, but can get the job done.
I have had a problem with the pager though :(
Comment #17
peter-boeren CreditAttribution: peter-boeren commentedI'm working on a module called Views filter pack and it work with views 2. My solution is not with much fancy Ajax, but you can alter the exposed selects to radio-buttons or even check boxes. At this point only the filters from user, node, comment and taxonomy are supported. The filters for files are on the roadmap and so is CCK support.
Comment #18
czeky CreditAttribution: czeky commentedsubscribing
Comment #19
thebuckst0p CreditAttribution: thebuckst0p commentedI worked out a solution to this using a custom theme function for the select field. Details @ http://echodittolabs.org/blog/2009/09/how-make-views-exposed-filter-dropdown-appear-checkboxes.
Comment #20
tevih CreditAttribution: tevih commentedI don't understand where to put this.
Comment #21
mikeker CreditAttribution: mikeker commentedI just contributed a module similar to the solution @19: Better Exposed Filters. Sorry, only available for D6.
I was having problems with Views Filter Pack not working with multiple exposed filters and Ben's theme-layer suggestion (see the link @19) was an elegant solution.
Hope that helps.
- Mike
Comment #22
doublejosh CreditAttribution: doublejosh commentedHad a related issue with the promoted to front page exposed filter. Solved here: http://drupal.org/node/549180#comment-3795560