This project is not covered by Drupal’s security advisory policy.

Integration with Facets

Please note that the facets module has included a submodule called Facets Summary which covers the pills functionality, the use of that module is recommended instead.

Overview

Active Facet Pills provides a block that can be used on faceted search pages to display the active facets as pills.

  • Displays pills for all the facets in one block;
  • Each pill contains a close link to remove the facet from the current search;
  • The links can be altered from a module of theme;
  • Additional pills can be added from a module or theme.

Usage

  • Install and enable module active_facet_pills;
  • Create a search/view page with facets using the Facets module;
  • Place the block Active Facet Pills block where you wish to see it on the page.

Once you have done this, the block will display one pill for every enabled facet. You can close the facet by clicking on the pill

Modifying the links

If you wish to modify the links used to remove individual facets, you can implement hook_active_facet_pills_links_alter. A typical use case is to reset the pagination when a facet is closed:

/**
 * Implement hook_active_facet_pills_links_alter
 *
 * This is used to:
 * - remove 'page' from the queries so removing a facet resets the pagingation
 */
function exampletheme_active_facet_pills_links_alter(&$links) {
  // Remove 'page'
  foreach ($links as $id => $item) {
      $links[$id]['url'] = preg_replace('/(&|\?)page=\d+/', '', $links[$id]['url']);
  }
}

You can also use hook_active_facet_pills_links_alter to add extra pills, for example if you want to add search terms as pills.

Supporting organizations: 

Project information

Releases