submitForm of a custom form, I have this:
$sFileName = 'sites/default/files/_private/bulletins/' . $form_state->getValue('adherent') . ".pdf"; $response = new BinaryFileResponse($sFileName); $response->setContentDisposition( ResponseHeaderBag::DISPOSITION_ATTACHMENT, 'bulletin.pdf' ); $form_state->setResponse($response);
This triggers the download of a pdf document and it works.
Then, I try to execute:
and that is not working!
FormState::setResponse documentation, I read « If a response is set, it will be used during processing and returned directly. The form will not be rebuilt or redirected ».
I guess it is why my redirection to doesn't work...
How can I do it anyway?