I'm looking for some help implementing an exposed filter as an on/off toggle option that either applies or ignores a filter. I want to filter on a taxonomy field, using the Is one of operator and the Limit list to selected items option. I would like to render the filter as a checkbox that when checked returns all nodes with any one of the terms in the limited list. If not selected I want the view to ignore the filter. Or, to put it another way, If the filter is selected, this is equivalent to selecting any one of the limited terms. If the filter is not selected this is equivalent to selecting Any. I think this would be a very useful feature.
How would I go about implementing this? BEF seems like a good place to start. If anyone can give me some pointers I'd be very grateful.

CommentFileSizeAuthor
#2 toggle_filter_option-1910186-2.patch2.84 KBvinothg
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

mikeker’s picture

Status: Active » Postponed

It's an interesting idea, but I think this functionality is beyond the scope of BEF.

One option would be to implement this in the theme layer -- use jQuery to add the filter-on-off checkboxes and, when clicked, select/unselect the items in the exposed filter. Another option, if you're not using AJAX, is to use "canned" filters setting each filter option as part of a GET or POST. (When you hit apply, in a regular filter you'll see all the options in the URL).

vinothg’s picture

Version: 7.x-3.0-beta3 » 7.x-3.2
Issue summary: View changes
Status: Postponed » Needs review
FileSize
2.84 KB

I fixed this issue by adding an option called "Toggle Links" and used the same in the theme method to change the links into toggle links. I have attached the patch file for the same. Please review the patch.

Thanks,
Vinoth

Status: Needs review » Needs work

The last submitted patch, 2: toggle_filter_option-1910186-2.patch, failed testing.

mikeker’s picture

Status: Needs work » Postponed (maintainer needs more info)

I still don't see why this cannot be done with existing functionality: A grouped filter with the options you want in one group and a "not" of those options in another group. Considering grouped filters gives you radio buttons and checkboxes, you wouldn't even need BEF....

Am I missing something?

mikeker’s picture

Status: Postponed (maintainer needs more info) » Closed (won't fix)

Issue queue cleanup... Closing since there was no reply to the request for additional information.