I'm working with a custom entity and would like to programmatically set the redirect based on submitted values.
When I set the redirect path however, the user is redirected to the canonical path instead of the path I'm setting in the redirect.
In the file mymodule/src/Form/MyEntityForm.php
, I'm doing something like this:
public function submitForm(array &$form, FormStateInterface $form_state)
{
// Note: Same results with the order of the next 2 lines reversed.
parent::submitForm($form, $form_state);
$form_state->setRedirect('mymodule.overview', ['state' => 'CA']);
}
So how would I set the destination of an entity form submission dynamically?