From b7b5d0278be1efdcc5705bf9f0e82977d6e6faad Mon Sep 17 00:00:00 2001 From: Jens Schuppe Date: Tue, 20 Feb 2024 11:21:17 +0100 Subject: [PATCH] Use `setRedirectUrl()` instead of route-based redirects --- modules/civiremote_event/src/Form/RegisterForm.php | 6 +----- .../civiremote_event/src/Form/RegistrationCancelForm.php | 6 +----- .../civiremote_event/src/Form/RegistrationUpdateForm.php | 6 +----- 3 files changed, 3 insertions(+), 15 deletions(-) diff --git a/modules/civiremote_event/src/Form/RegisterForm.php b/modules/civiremote_event/src/Form/RegisterForm.php index 6f2349d..48b18f5 100644 --- a/modules/civiremote_event/src/Form/RegisterForm.php +++ b/modules/civiremote_event/src/Form/RegisterForm.php @@ -1211,11 +1211,7 @@ public function submitForm(array &$form, FormStateInterface $form_state) { /* @var Url $url */ $url = Drupal::service('path.validator') ->getUrlIfValid($config->get('form_redirect_route')); - $form_state->setRedirect( - $url->getRouteName(), - $url->getRouteParameters(), - $url->getOptions() - ); + $form_state->setRedirectUrl($url); } } catch (Exception $exception) { diff --git a/modules/civiremote_event/src/Form/RegistrationCancelForm.php b/modules/civiremote_event/src/Form/RegistrationCancelForm.php index 840514e..a11ea4c 100644 --- a/modules/civiremote_event/src/Form/RegistrationCancelForm.php +++ b/modules/civiremote_event/src/Form/RegistrationCancelForm.php @@ -136,11 +136,7 @@ public function submitForm(array &$form, FormStateInterface $form_state) { /* @var Url $url */ $url = Drupal::service('path.validator') ->getUrlIfValid($config->get('form_redirect_route')); - $form_state->setRedirect( - $url->getRouteName(), - $url->getRouteParameters(), - $url->getOptions() - ); + $form_state->setRedirectUrl($url); } /** diff --git a/modules/civiremote_event/src/Form/RegistrationUpdateForm.php b/modules/civiremote_event/src/Form/RegistrationUpdateForm.php index 0189597..1c1409b 100644 --- a/modules/civiremote_event/src/Form/RegistrationUpdateForm.php +++ b/modules/civiremote_event/src/Form/RegistrationUpdateForm.php @@ -84,11 +84,7 @@ public function submitForm(array &$form, FormStateInterface $form_state) { /* @var Url $url */ $url = Drupal::service('path.validator') ->getUrlIfValid($config->get('form_redirect_route')); - $form_state->setRedirect( - $url->getRouteName(), - $url->getRouteParameters(), - $url->getOptions() - ); + $form_state->setRedirectUrl($url); } } catch (Exception $exception) {