Skip to content

Commit

Permalink
Use setRedirectUrl() instead of route-based redirects
Browse files Browse the repository at this point in the history
  • Loading branch information
jensschuppe committed Feb 20, 2024
1 parent cba5b8d commit b7b5d02
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 15 deletions.
6 changes: 1 addition & 5 deletions modules/civiremote_event/src/Form/RegisterForm.php
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
6 changes: 1 addition & 5 deletions modules/civiremote_event/src/Form/RegistrationCancelForm.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

/**
Expand Down
6 changes: 1 addition & 5 deletions modules/civiremote_event/src/Form/RegistrationUpdateForm.php
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit b7b5d02

Please sign in to comment.