You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Description Sylius\Bundle\ResourceBundle\Controller\RequestConfiguration manage crud redirection after update.
According to the function :
publicfunctiongetRedirectRoute($name)
{
$redirect = $this->parameters->get('redirect');
if (null === $redirect) {
return$this->getRouteName($name);
}
if (is_array($redirect)) {
if (!empty($redirect['referer'])) {
return'referer';
}
return$redirect['route'];
}
return$redirect;
}
There is a possibility to configure custom ressource crud redirection called 'referer'.
And allow user to go back on the previous request url.
Actually, by default, the user is redirected to the show route, according to Sylius\Bundle\ResourceBundle\Controller\RedirectHandler file :
instead of get a string with 'referer' value as configured, you'll get a reworked and prefixed string value. I don't know why this configuration value is now considered as a route name.
dd($redirect);
src/Bundle/Controller/RequestConfiguration.php on line 163:
"sylius_admin_toto_referer"
Conclusion :
To make referer redirection working, we have to take care about a string value and not array anymore.
And test value ending with "referer" string instead of testing if it's equal to 'referer' as declared in my configuration.
Sylius version affected: 1.13.10
Issue also created here : Sylius/Sylius#17686
Description
Sylius\Bundle\ResourceBundle\Controller\RequestConfiguration
manage crud redirection after update.According to the function :
There is a possibility to configure custom ressource crud redirection called 'referer'.
And allow user to go back on the previous request url.
Actually, by default, the user is redirected to the show route, according to
Sylius\Bundle\ResourceBundle\Controller\RedirectHandler
file :The expected behavior, after configuring my referer redirection in my route configuration is that the function
getRedirectRoute
returnreferer
.But it's not working, because now Sylius rework the route name and add a prefix.
For exemple :
The dump return 'app_admin_test_referer' instead of the configured value.
Steps to reproduce
Create a custom resource admin and add a referer redirection and in your
routes.yaml
addredirection: referer
:Possible Solution
Into
Sylius\Bundle\ResourceBundle\Controller\RequestConfiguration
change way to detect 'referer' value.The text was updated successfully, but these errors were encountered: