Giter VIP home page Giter VIP logo

better_exposed_filters's Introduction

Better Exposed Filters

Replaces the Views' default single-select or multi-select elements with radio buttons or checkboxes, respectively.

Views Filters are a powerful tool to limit the results of a given view. When you expose a filter, you allow the user to interact with the view making it easy to build a customized advanced search. For example, exposing a taxonomy filter lets your site visitor search for articles with specific tags. Better Exposed Filters gives you greater control over the rendering of exposed filters.

Installation

  • Install this module using the official Backdrop CMS instructions
  • Configure any view under Administration > Structure > Views.
  • Adjust the view to use Better Exposed filters under Advanced > Exposed Form.

Documentation

Additional documentation is located in the Wiki

Issues

Bugs and Feature requests should be reported in the Issue Queue

Current Maintainers

Credits

License

This project is GPL v2 software. See the LICENSE.txt file in this directory for complete text.

better_exposed_filters's People

Contributors

etroid avatar jenlampton avatar laryn avatar mikeker avatar taz77 avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

better_exposed_filters's Issues

A11Y: Checkbox groups and fieldsets

The checkbox filter has an option to put it in a collapsible fieldset:
CleanShot 2023-11-16 at 13 09 55@2x

However, if you don't want it collapsed (and so don't select this option), there is no fieldset at all, which raises A11Y flags:

Alerts

Missing fieldset

What It Means

A group of check boxes or radio buttons is not enclosed in a fieldset.

Why It Matters

A fieldset provides a visual and structural grouping of related form elements. It is typically necessary for groups of check boxes or radio buttons where a higher level description (called a legend) is necessary to understand the function of the check boxes or radio buttons. The description will be identified by a screen reader only if provided in a fieldset legend.

How to Fix It

Determine whether the grouping of check boxes or radio buttons has or needs text that explains the purpose of the check boxes or radio button grouping. If so, mark up the group within a fieldset and put the group description in a legend element.

The Algorithm... in English

Two or more checkbox or radio input elements within a form have the same name value, but are not enclosed in a fieldset.

Would it make sense to include sets of checkboxes in a non-collapsible fieldset by default, and make it collapsible if the toggle is on?

Each() Deprecated on PHP 7.2

PHP Error on PHP 7.3 (and 7.2)

Deprecated function: The each() function is deprecated. This message will be suppressed on further calls in theme_select_as_links() (line 521 of /Users/andy/Sites/fantsuam-new/httpdocs/modules/contrib/better_exposed_filters/better_exposed_filters.theme.inc).

Backdrop 1.11.3
Better Exposed Filters 1.x-3.4.1
PHP 7.3

Issue and Fix on Drupal.org
https://www.drupal.org/project/better_exposed_filters/issues/2946585

I'll see if I can apply the same patch.

jQuery modernization

The .js should be combed through a bit to make sure deprecations are fixed for the latest jQuery.

A non-exhaustive list to start from:

  • jQuery.fn.change() event shorthand is deprecated
  • jQuery.fn.click() event shorthand is deprecated
  • jQuery.fn.bind() is deprecated
  • jQuery.fn.focus() is deprecated
  • jQuery.fn.resize() event shorthand is deprecated

A11Y: Select as Links should be within a list element

An internal accessibility review of a site that is using BEF's "Select as Links" functionality came back with this:

...these links should be within a list element similar to a nav with correct aria-current in use.

I'm going to see how easy it would be to convert this implementation to use <ul> and <li> instead of <div>.

Collapsed filters disappearing completely

Select filters shown as checkboxes in a fieldset do not show when collapsed :
capture d ecran 2016-02-10 a 23 42 32
This would be addressed in better_exposed_filters.css :

/*
 * Prevents collapsed filters from disappearing completely
 */
fieldset.bef-select-as-radios-fieldset.collapsed legend,
fieldset.bef-select-as-checkboxes-fieldset.collapsed legend {
  position: relative;
}

Two problems :
1- The css file would be attached by :
$form[$filter_id]['#attached']['css'][] = backdrop_get_path('module', 'better_exposed_filters') . '/better_exposed_filters.css';
but the css file has been relocated in a css subfolder, so it's ignored...

2- Even after introducing this rule in my custom css, the result is not very good :
capture d ecran 2016-02-10 a 23 43 11

I finally got the expected result in overriding a rule from views.css stating :

views-exposed-form .views-exposed-widget {
    display: inline-block;
}

with in my custom css :

.block .views-exposed-form .views-exposed-widget {
  display: block;
}

capture d ecran 2016-02-10 a 23 43 36

Fine, but now, this is no more specific to better exposed filters...

I'm not experienced enough in backdrop views to confirm this is a views' bug, or this should be locally addressed by BEF…

Warning: Undefined array key "#options" in better_exposed_filters_exposed_form_plugin->exposed_form_alter() (line 1115 of ../better_exposed_filters_exposed_form_plugin.inc).

Rewrite the text displayed as shown on BEF settings like so:

Screenshot 2024-01-19 at 11 31 41 PM

and you will see no result of the override, but two warnings:

    Warning: Undefined array key "#options" in better_exposed_filters_exposed_form_plugin->exposed_form_alter() (line 1115 of /var/www/html/docroot/modules/contrib/better_exposed_filters/views/better_exposed_filters_exposed_form_plugin.inc).
    Warning: foreach() argument must be of type array|object, null given in better_exposed_filters_exposed_form_plugin->exposed_form_alter() (line 1115 of /var/www/html/docroot/modules/contrib/better_exposed_filters/views/better_exposed_filters_exposed_form_plugin.inc).

each() function is deprecated Backdrop Site built on PHP Version: 7.3.21

Developing a site locally and logs the following error. Can a patch be committed to the next release?

Deprecated function: The each() function is deprecated. This message will be suppressed on further calls in theme_select_as_links() (line 521 of C:\wamp64\www\domain\modules\better_exposed_filters\better_exposed_filters.theme.inc).

Get tests working

It looks like tests exist from D7 -- we should get them working here.

Updates from Drupal 7.x-3.x

There are a number of commits in the respective Drupal 7 version of this module which should get pulled over here.

Co-maintainer?

@jenlampton I see you're looking for a co-maintainer. Mind if I join to try to bring over some commits from Drupal 7 and maintain here?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.