Needs review
Project:
Facets
Version:
2.0.x-dev
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
10 Jul 2026 at 08:21 UTC
Updated:
10 Jul 2026 at 08:54 UTC
Jump to comment: Most recent
On Drupal 11.4 was introduced the query on the method Url::createFromRequest https://www.drupal.org/project/drupal/issues/2985400
Commit https://git.drupalcode.org/project/drupal/-/commit/478f4da250a8e58dbaa33...
public static function createFromRequest(Request $request) {
// We use the router without access checks because URL objects might be
// created and stored for different users.
$result = \Drupal::service('router.no_access_checks')->matchRequest($request);
$route_name = $result[RouteObjectInterface::ROUTE_NAME];
$route_parameters = $result['_raw_variables']->all();
- return new static($route_name, $route_parameters);
+ $options = [
+ 'query' => $request->query->all(),
+ ];
+ return new static($route_name, $route_parameters, $options);
}
On facets/src/Plugin/facets/url_processor/QueryString::buildUrls()
If the condition is not met, the query is not set, keeping the query strings on the url, and never removing the facet .
if ($result_get_params->all() !== [$this->filterKey => []]) {
$new_url_params = $result_get_params->all();
if (empty($new_url_params[$this->filterKey])) {
unset($new_url_params[$this->filterKey]);
}
// Facet links should be page-less.
// See https://www.drupal.org/node/2898189.
unset($new_url_params['page']);
// Remove core wrapper format (e.g. render-as-ajax-response) parameters.
unset($new_url_params[MainContentViewSubscriber::WRAPPER_FORMAT]);
// Set the new url parameters.
$url->setOption('query', $new_url_params);
}
Clear the remaining facets from query.
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #3
eduardo morales albertiAI Generated Code
Mainly generated by AI, reviewed and approved by a human before this MR was created.
Comment #4
eduardo morales alberti