Issue #3541709 by mably: Keep core's redirect guards and drop TrustedRedirectResponse

Setting a response on the form state bypasses the checks that FormState::getRedirect() applies, so a programmatic submission, a rebuilding form or a form whose redirect has been disabled (AJAX and HTMX submissions) would have been redirected where core would not redirect at all. The redirect is now set with setRedirectUrl() as before and only promoted to a response when another submit handler has already set one, and only when getRedirect() confirms core would redirect.

The target is always the entity's own edit form, so a plain RedirectResponse is enough and TrustedRedirectResponse is not needed.

Closes #3541709

Merge request reports

Loading
Loading