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.
I tried to use custom paths but get an error when doing search.
In /admin/structure/block/manage/customsearchform, on "Custom Search Paths", I set the following paths :
Paths:
http://www.google.com/q?=[key]|google
http://www.bing.com/q?=[key]|bing
When the user is validating the search form, he get the following error :
"Redirects to external URLs are not allowed by default, use \Drupal\Core\Routing\TrustedRedirectResponse for it."
I am using Drupal 8.1.10 and custom_search 8.x-1.0-beta3
Comment | File | Size | Author |
---|---|---|---|
#2 | custom_search_trustedredirectresponse.patch | 874 bytes | blink38 |
Comments
Comment #2
blink38 CreditAttribution: blink38 commentedI found a solution and made a patch
This first response explain how to use TrustedRedirectResponse in form response :
http://drupal.stackexchange.com/questions/136641/how-do-i-redirect-to-an...
I changed in CustomSearchBlockForm.php the response of submitForm() so that when url is external, the response use TrustedRedirectResponse.
Comment #4
jdanthinne CreditAttribution: jdanthinne commentedThanks. Pushed to dev.