Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Problem/Motivation
Contact form is missing the feature to redirect form to custom specified URLs. There is a related core issue #306662: Add redirect option to site-wide contact forms which is trying to do something similar.
Proposed resolution
Add the option for adding custom redirect URL to contact forms after submitting.
Remaining tasks
User interface changes
API changes
Data model changes
Comment | File | Size | Author |
---|---|---|---|
#7 | interdiff.txt | 1.04 KB | larowlan |
#2 | redirect_page_uri.png | 13.19 KB | mbovan |
#2 | add_a_custom_redirect-2584723-2.patch | 3.71 KB | mbovan |
|
Comments
Comment #2
mbovan CreditAttribution: mbovan at MD Systems GmbH commentedHere is the patch that we use in a custom module. Additionally, I added tests.
Currently, we can only redirect to the pages on the website. We should discuss if we want to allow users redirection to external websites.
UI changes:
Comment #3
larowlanThank you for this patch! awesome work
nit: can we do:
if ($redirect_url = $contact_form->get...)
to save the two calls to ->getThirdPartySetting()?<3 it - this a a great patch!
Comment #4
larowlanComment #5
larowlanGonna fix the nit and commit
Comment #7
larowlanFixed, thanks
Committed with this interdiff.
Comment #9
YuanZheCSYZ CreditAttribution: YuanZheCSYZ commentedHi guys,
It seems this redirect uri only works with the default form (/contact), not when it comes to embed the form into pages nor blocks.
Any help on this? Thanks