Skip to main content
drupalreleases

Use direct release data with your AI assistant.

Learn more

Facets Form

Security covered Under active development 352 sites

Part of the Facets ecosystem · 26 projects

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.

Drupal 10–11

Ask your assistant about Facets Form

Check compatibility with your Drupal and PHP version, maintenance and security coverage, from current release data. How it works

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
6
Tracked since
Mar 2023
Latest release
10 months ago
Releases (12 mo)
1 ▼ from 2
Maintenance
Active

Release Timeline

Releases

Version Type Core PHP 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
1.0.0 Stable 9–10 Jul 18, 2024
1.0.0-alpha6 Pre-release 9–10 Jun 1, 2023
1.0.0-alpha5 Pre-release 8–9 Mar 17, 2023