Skip to content

Commit 4c1c63b

Browse files
committedFeb 20, 2025·
bug #6832 Always return to index when using SAVE_AND_RETURN button (fracsi)
This PR was merged into the 4.x branch. Discussion ---------- Always return to index when using SAVE_AND_RETURN button Fixes: #6830 Note: #6822 fixed the deprected usage of the getReferrer, but the getReferrer method returned empty, thus the redirect to the list was working Commits ------- aabe86c Always return to index when using SAVE_AND_RETURN button
2 parents 2af62d7 + aabe86c commit 4c1c63b

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed
 

‎src/Controller/AbstractCrudController.php

+1-2
Original file line numberDiff line numberDiff line change
@@ -639,8 +639,7 @@ protected function getRedirectResponseAfterSave(AdminContext $context, string $a
639639
->setAction(Action::EDIT)
640640
->setEntityId($context->getEntity()->getPrimaryKeyValue())
641641
->generateUrl(),
642-
Action::SAVE_AND_RETURN => $context->getRequest()->headers->get('referer')
643-
?? $this->container->get(AdminUrlGenerator::class)->setAction(Action::INDEX)->generateUrl(),
642+
Action::SAVE_AND_RETURN => $this->container->get(AdminUrlGenerator::class)->setAction(Action::INDEX)->generateUrl(),
644643
Action::SAVE_AND_ADD_ANOTHER => $this->container->get(AdminUrlGenerator::class)->setAction(Action::NEW)->generateUrl(),
645644
default => $this->generateUrl($context->getDashboardRouteName()),
646645
};

1 commit comments

Comments
 (1)

pfpro commented on Mar 11, 2025

@pfpro
Contributor

I have a widget on my EA dashboard with ea crud edit links.
I added "&referrer=https://.../admin" to the query string for these links and was redirected back to my dashboard this way after submitting the edit form.

Since the new version, I have been redirected to the index page of the corresponding crud controller instead of the dashboard.

Is there an alternative way now to restore the desired redirect behavior?

Please sign in to comment.