From f2e21f3a1a7f3dcb87b6864a79a8f2fddd49e89f Mon Sep 17 00:00:00 2001 From: Rosie Le Faive Date: Thu, 26 Jan 2023 10:14:40 -0400 Subject: [PATCH] Use new request stack. Addresses #9. --- src/Controller/AjaxBlocksController.php | 3 +-- src/Form/AdvancedSearchForm.php | 2 +- src/Plugin/Block/AdvancedSearchBlock.php | 2 +- src/Plugin/Block/SearchResultsPagerBlock.php | 2 +- 4 files changed, 4 insertions(+), 5 deletions(-) diff --git a/src/Controller/AjaxBlocksController.php b/src/Controller/AjaxBlocksController.php index 9eb7739..c5e3fb8 100644 --- a/src/Controller/AjaxBlocksController.php +++ b/src/Controller/AjaxBlocksController.php @@ -11,7 +11,6 @@ use Drupal\Core\Render\RendererInterface; use Drupal\Core\Routing\CurrentRouteMatch; use Symfony\Component\DependencyInjection\ContainerInterface; use Symfony\Component\HttpFoundation\Request; -use Symfony\Component\HttpFoundation\RequestStack; use Symfony\Component\HttpKernel\Exception\NotFoundHttpException; use Symfony\Component\Routing\RouterInterface; @@ -136,7 +135,7 @@ class AjaxBlocksController extends ControllerBase { } $new_request = Request::create($path); - $request_stack = new RequestStack(); + $request_stack = \Drupal::requestStack(); $processed = $this->pathProcessor->processInbound($new_request->getPathInfo(), $new_request); $this->currentPath->setPath($processed); diff --git a/src/Form/AdvancedSearchForm.php b/src/Form/AdvancedSearchForm.php index 7637cf4..4316eed 100644 --- a/src/Form/AdvancedSearchForm.php +++ b/src/Form/AdvancedSearchForm.php @@ -71,7 +71,7 @@ class AdvancedSearchForm extends FormBase { */ public static function create(ContainerInterface $container) { return new static( - $container->get('request_stack')->getMasterRequest(), + $container->get('request_stack')->getMainRequest(), $container->get('current_route_match') ); } diff --git a/src/Plugin/Block/AdvancedSearchBlock.php b/src/Plugin/Block/AdvancedSearchBlock.php index 7ce64fe..5db6c2e 100644 --- a/src/Plugin/Block/AdvancedSearchBlock.php +++ b/src/Plugin/Block/AdvancedSearchBlock.php @@ -108,7 +108,7 @@ class AdvancedSearchBlock extends BlockBase implements ContainerFactoryPluginInt $plugin_definition, $container->get('plugin.manager.search_api.display'), $container->get('form_builder'), - $container->get('request_stack')->getMasterRequest() + $container->get('request_stack')->getMainRequest() ); } diff --git a/src/Plugin/Block/SearchResultsPagerBlock.php b/src/Plugin/Block/SearchResultsPagerBlock.php index 498cc64..b47edb8 100644 --- a/src/Plugin/Block/SearchResultsPagerBlock.php +++ b/src/Plugin/Block/SearchResultsPagerBlock.php @@ -58,7 +58,7 @@ class SearchResultsPagerBlock extends BlockBase implements ContainerFactoryPlugi $configuration, $plugin_id, $plugin_definition, - $container->get('request_stack')->getMasterRequest() + $container->get('request_stack')->getMainRequest() ); }