Skip to content
Snippets Groups Projects
Commit 4ebbe259 authored by Pedro Cambra's avatar Pedro Cambra Committed by Markus Kalkbrenner
Browse files

Issue #3390365: Avoid instanciating url_generator service in a foreach

parent bbf60c4f
No related branches found
Tags 8.x-2.3
No related merge requests found
......@@ -52,13 +52,16 @@ class RangeSliderProcessor extends SliderProcessor implements PreQueryProcessorI
unset($active_filters['']);
}
/** @var \Drupal\facets\Utility\FacetsUrlGenerator $url_generator */
$url_generator = \Drupal::service('facets.utility.url_generator');
/** @var \Drupal\facets\Result\ResultInterface[] $results */
foreach ($results as &$result) {
$new_active_filters = $active_filters;
unset($new_active_filters[$facet->id()]);
// Add one generic query filter with the min and max placeholder.
$new_active_filters[$facet->id()][] = '(min:__range_slider_min__,max:__range_slider_max__)';
$url = \Drupal::service('facets.utility.url_generator')->getUrl($new_active_filters, FALSE);
$url = $url_generator->getUrl($new_active_filters, FALSE);
$result->setUrl($url);
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment