Uncheck ckeckbox in Drupal 9 Facets with Pretty Path

Today's problem - in Views page, which derives the list of nodex in Drupal 9 there is a filtration using the Facets module, Facets Pretty Patch and Facets Short Pretty Paths module (for the output of URL without ID Term Taxonomy). The problem is the following - after the Facets filter is used in the form of checkbox - it is impossible to remove it. The page is restarted but the filter is still applied.

Log error is empty, console log not show eny error.

The next patch for pretty path module helped for me

diff --git a/src/Plugin/facets/url_processor/FacetsPrettyPathsUrlProcessor.php b/src/Plugin/facets/url_processor/FacetsPrettyPathsUrlProcessor.php
index 9bb27d7..f93c8c2 100644
--- a/src/Plugin/facets/url_processor/FacetsPrettyPathsUrlProcessor.php
+++ b/src/Plugin/facets/url_processor/FacetsPrettyPathsUrlProcessor.php
@@ -162,7 +162,12 @@ class FacetsPrettyPathsUrlProcessor extends UrlProcessorPluginBase implements Co
      }
      $pretty_paths_presort_data = $this->sortByWeightAndName($pretty_paths_presort_data);
      $pretty_paths_string = implode('', array_column($pretty_paths_presort_data, 'pretty_path_alias'));
-      $url = Url::fromUri('internal:' . $facet->getFacetSource()->getPath() . $pretty_paths_string);
+      // Remove the leading slash.
+      $pretty_paths_string = ltrim($pretty_paths_string, '/');
+      // Get the existing URL.
+      $url = Url::fromUri('internal:' . $facet->getFacetSource()->getPath());
+      // Set the facets_query to the updated facets.
+      $url->setRouteParameter('facets_query', $pretty_paths_string);
      $url->setOption('attributes', ['rel' => 'nofollow']);

      // First get the current list of get parameters.

Plain text

  • No HTML tags allowed.
  • Lines and paragraphs break automatically.
  • Web page addresses and email addresses turn into links automatically.
The comment language code.