I created my webform to accept parameters via a standard $_GET
and this works fine but is quite unsecure I am told and should rather use clean URL's via Drupal 8 built in Routing.
As such I set up a module to support my webform and contains only a info.yml
and routing.ynl
. The routing is as below, I got the format from Using parameters in routes but suspect I just haven't grasped it.
abc_enquire_form_routing.webform:
path: /form/enquire/{type}/{region}/{destination}
requirements:
_permission: 'access content'
defaults:
type: 'tailor-made-holidays'
Normal form access is via http://abcsite.localhost/form/enquire
Form access with parameters as a get (For illustration) was: http://abcsite.localhost/form/enquire?type=tailor-made-holidays®ion=asia&destination=48
Module name is: abc_enquire_form_routing
Trying to access the form with the module enabled with the above routing through http://abcsite.localhost/form/enquire/tailor-made-holidays is simply giving me a p "The requested page could not be found." error. So I can only assume I am doing the routing wrong.
What I am trying to achieve is three optional parameters after the "http://abcsite.localhost/form/enquire" page of the url, e.g. http://abcsite.localhost/form/enquire/tailor-made-holidays/asia/49
Can anyone point me in the direction of a good example of doing this with webforms module ?