Backend and Infrastructure

Create a Facet for Drupal 8, 9, and 10

Creating a facet in Drupal is rather different from using Facets API in Drupal 7. In the new module, we first create a search view, and then configure facets against target fields in the index. Once created, we must configure the facet UI to appear on target pages using the Blocks UI.

In this tutorial, we'll:

  • List the steps necessary to create a facet using a non-reference field (i.e. boolean, or text list)
  • Explain why facets are displayed using blocks
  • Describe the various facet display modes and uses for each

By the end of this tutorial you should be able to add a facet based on a text list field and allow users to filter search results using the values in the list field.