From 22ca1036377fe090577917629bd6784acb1bcd1c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sven=20Sch=C3=BCring?= <ssch@zenmotion.de> Date: Tue, 17 Oct 2023 12:09:59 +0200 Subject: [PATCH] Fix #3384235: deprecation dynamic property --- src/Plugin/Block/OpenReadspeakerBlock.php | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/src/Plugin/Block/OpenReadspeakerBlock.php b/src/Plugin/Block/OpenReadspeakerBlock.php index 3a3860f..2a952f0 100644 --- a/src/Plugin/Block/OpenReadspeakerBlock.php +++ b/src/Plugin/Block/OpenReadspeakerBlock.php @@ -9,7 +9,7 @@ use Symfony\Component\DependencyInjection\ContainerInterface; use Drupal\Core\Plugin\ContainerFactoryPluginInterface; use Drupal\Core\Form\FormStateInterface; use Drupal\Core\Config\ConfigFactoryInterface; -use Symfony\Component\HttpFoundation\Request; +use Symfony\Component\HttpFoundation\RequestStack; /** * Provides a 'OpenReadspeakerBlock' block. @@ -28,6 +28,12 @@ class OpenReadspeakerBlock extends BlockBase implements ContainerFactoryPluginIn */ protected $configFactory; + /** + * The request stack. + * + * @var \Symfony\Component\HttpFoundation\RequestStack + */ + protected $requestStack; /** * Constructs a Drupal\Component\Plugin\PluginBase object. * @@ -39,7 +45,7 @@ class OpenReadspeakerBlock extends BlockBase implements ContainerFactoryPluginIn * The plugin implementation definition. * @param \Drupal\Core\Config\ConfigFactoryInterface $config_factory * The config factory service. - * @param \Symfony\Component\HttpFoundation\Request $request + * @param \Symfony\Component\HttpFoundation\RequestStack $requestStack * The current request. */ public function __construct( @@ -47,10 +53,10 @@ class OpenReadspeakerBlock extends BlockBase implements ContainerFactoryPluginIn $plugin_id, $plugin_definition, ConfigFactoryInterface $config_factory, - Request $request) { + RequestStack $requestStack) { parent::__construct($configuration, $plugin_id, $plugin_definition); $this->configFactory = $config_factory; - $this->request = $request; + $this->requestStack = $requestStack; } /** @@ -62,7 +68,7 @@ class OpenReadspeakerBlock extends BlockBase implements ContainerFactoryPluginIn $plugin_id, $plugin_definition, $container->get('config.factory'), - $container->get('request_stack')->getCurrentRequest() + $container->get('request_stack') ); } @@ -128,9 +134,10 @@ class OpenReadspeakerBlock extends BlockBase implements ContainerFactoryPluginIn $accountid = $config->get('open_readspeaker_accountid'); $cdn = $config->get('open_readspeaker_cdn_region'); $post_mode = $config->get('open_readspeaker_post_mode'); + $request = $this->requestStack->getCurrentRequest(); $url = Url::fromRoute( '<current>', - $this->request->query->all(), + $request->query->all(), ['absolute' => TRUE] )->toString(); -- GitLab