Skip to content
Snippets Groups Projects
Commit d50177be authored by Markus Kalkbrenner's avatar Markus Kalkbrenner Committed by Markus Kalkbrenner
Browse files

Issue #3258992 by heddn, mkalkbrenner, idebr: [Drupal 9.3.x] Replace...

Issue #3258992 by heddn, mkalkbrenner, idebr: [Drupal 9.3.x] Replace getMasterRequest() with getMainRequest()
parent 0a58c2f6
No related branches found
Tags 6.x-2.0
No related merge requests found
......@@ -35,7 +35,10 @@ class ResetFacetsProcessor extends ProcessorPluginBase implements BuildProcessor
return $build;
}
$request = \Drupal::requestStack()->getMasterRequest();
$request_stack = \Drupal::requestStack();
// Support 9.3+.
// @todo remove switch after 9.3 or greater is required.
$request = version_compare(\Drupal::VERSION, '9.3', '>=') ? $request_stack->getMainRequest() : $request_stack->getMasterRequest();
$query_params = $request->query->all();
// Bypass all active facets and remove them from the query parameters array.
......
......@@ -16,8 +16,11 @@ abstract class HierarchyPluginBase extends ProcessorPluginBase implements Hierar
* {@inheritdoc}
*/
public static function create(ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition) {
/** @var \Symfony\Component\HttpFoundation\Request $request */
$request = $container->get('request_stack')->getMasterRequest();
$request_stack = $container->get('request_stack');
// Support 9.3+.
// @todo remove switch after 9.3 or greater is required.
$request = version_compare(\Drupal::VERSION, '9.3', '>=') ? $request_stack->getMainRequest() : $request_stack->getMasterRequest();
return new static($configuration, $plugin_id, $plugin_definition, $request);
}
......
......@@ -106,6 +106,8 @@ class SearchApiDisplay extends FacetSourcePluginBase implements SearchApiFacetSo
return new \stdClass();
}
$request_stack = $container->get('request_stack');
return new static(
$configuration,
$plugin_id,
......@@ -113,7 +115,9 @@ class SearchApiDisplay extends FacetSourcePluginBase implements SearchApiFacetSo
$container->get('plugin.manager.facets.query_type'),
$container->get('search_api.query_helper'),
$container->get('plugin.manager.search_api.display'),
$container->get('request_stack')->getMasterRequest(),
// Support 9.3+.
// @todo remove switch after 9.3 or greater is required.
version_compare(\Drupal::VERSION, '9.3', '>=') ? $request_stack->getMainRequest() : $request_stack->getMasterRequest(),
$container->get('module_handler')
);
}
......
......@@ -113,11 +113,15 @@ abstract class UrlProcessorPluginBase extends ProcessorPluginBase implements Url
* {@inheritdoc}
*/
public static function create(ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition) {
$request_stack = $container->get('request_stack');
return new static(
$configuration,
$plugin_id,
$plugin_definition,
$container->get('request_stack')->getMasterRequest(),
// Support 9.3+.
// @todo remove switch after 9.3 or greater is required.
version_compare(\Drupal::VERSION, '9.3', '>=') ? $request_stack->getMainRequest() : $request_stack->getMasterRequest(),
$container->get('entity_type.manager')
);
}
......
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