Drupal is a registered trademark of Dries Buytaert
Protected Pages 3.0.0 Major update available for module protected_pages (3.0.0). Commerce Core 3.3.8 Minor update available for module commerce (3.3.8). Search API HTML Element Filter 1.0.7 Minor update available for module search_api_html_element_filter (1.0.7). Layout Builder Reorder 2.0.1 Minor update available for module layout_builder_reorder (2.0.1). Ban 1.1.0 Minor update available for module ban (1.1.0). Field Formatter Range 2.0.0 Major update available for module field_formatter_range (2.0.0). Field Formatter Range 8.x-1.8 Minor update available for module field_formatter_range (8.x-1.8). Varbase Media Header 9.2.1 Minor update available for module varbase_media_header (9.2.1). Search API Solr 4.3.11 Module search_api_solr updated after 14 months of inactivity (4.3.11). Provus Mega Menu Module provus_mega_menu crossed 1,000 active installs.

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.

Activity

Total releases
2
First release
Feb 2025
Latest release
7 months ago
Releases (12 mo)
1
Maintenance
Active

Releases

Version Type Release date
1.3.0 Stable Nov 19, 2025
1.2.0 Stable Feb 11, 2025