Skip to main content
Drupal is a registered trademark of Dries Buytaert
Release: OpenID Connect / OAuth client 3.0.0-alpha9 New alpha version released for module openid_connect (3.0.0-alpha9). Release: Opensolr Search 4.5.0 Minor update available for module opensolr_search (4.5.0). Release: Timelinr 1.0.1 Minor update available for module timelinr (1.0.1). Release: Video.js (HTML5 Video Player) 10.0.0-alpha1 First alpha version released for module videojs (10.0.0-alpha1). Usage Milestone: Simplify Module simplify crossed 10,000 active installs. Usage Milestone: Views Reference Filter Module entityreference_filter crossed 10,000 active installs. Usage Milestone: Dropdown Language Module dropdown_language crossed 10,000 active installs. Usage Milestone: Paragraphs Browser Module paragraphs_browser crossed 10,000 active installs. Usage Milestone: OpenAPI Module openapi crossed 10,000 active installs. Module Revived: Entityqueue Buttons 1.1.2 Module entityqueue_buttons updated after 8 months of inactivity (1.1.2).

Facets Form

350 sites Security covered Drupal 10–11 Facets ecosystem
View on drupal.org

This module provides a way to expose facets from a facets source as standard Drupal Form API elements, such as dropdowns or checkboxes. This allows for better integration with Drupal's form theming and alteration capabilities, and also enables users to select multiple filters before submitting.

Exposes facets from a facets source as Drupal Form API elements.

Why?

Even displayed as a dropdown select or checkboxes, the facet widgets are rendered as link lists. Then a JavaScript snippet is responsible to convert them into form elements, such as <select> or <input type="checkbox">.

This has some drawbacks:

  • Even the widgets are displayed as form elements, they are not piped through Drupal Form API. As a consequence, third-party code cannot perform form alterations, and they are not subject to standard Form API elements theming.
  • The current Facets implementation is applying the filter as soon as the element is selected or checked. This is a UX issue, mostly on mobile devices. Also, it doesn't allow scenarios where the user wants to do multiple filter selection before the filters are submitted.

Usage

  • Facets Form provides a block containing a form for each facets source.
  • By default, each block is exposing all eligible facets. But the site builder is able to limit the list of facets to be exposed from the block configuration.
  • The "submit" and "reset" buttons labels can be also be configured on block level.
  • Eligible facets are all facets using widgets plugins that are extending the \Drupal\facets_form\FacetsFormWidgetInterface. Facets Form module ships with two widgets, aiming to provide a Form API alternative to Facets module native widgets:
    • Dropdown (inside form) facets_form_dropdown
    • Checkboxes (inside form) facets_form_checkbox
  • The facets_form_date_range sub-module provides a third, bonus, date range widget.

Extending

Third-party modules can provide additional widgets to be usable inside forms, by implementing the \Drupal\facets_form\FacetsFormWidgetInterface interface.

Depends on

Dependencies of the latest stable release

Required by

Tracked projects that depend on this one

No tracked projects depend on this one yet.

Activity

Tracked releases
3
Tracked since
Dec 2024
Latest release
9 months ago
Releases (12 mo)
1 ▼ from 2
Maintenance
Active

Release Timeline

Releases

Version Type Core Release date
1.3.0 Stable 10–11 Nov 19, 2025
1.2.0 Stable 10–11 Feb 11, 2025
1.1.0 Stable 9–10 Dec 16, 2024