When creating a new form in my Drupal 10 project, I would like a URL alias to be automatically be created for the form with /form/* as the prefix.
I can set pathauto rules for content types, but not web forms.
How is this done for web forms?
When creating a new form in my Drupal 10 project, I would like a URL alias to be automatically be created for the form with /form/* as the prefix.
I can set pathauto rules for content types, but not web forms.
How is this done for web forms?
/form
already comes as the default in the webform.setting.yml#L5
. Maybe it got changed in your project.
Double-check it with the following Drush command:
drush config:get webform.settings settings.default_page_base_path
To change it run the following Drush command and export config:
drush -y config:set webform.settings settings.default_page_base_path '/form' && drush -y config:export
On the edit page for a webform I also get this tooltip next to the "Webform URL alias" field:
Optionally specify an alternative URL by which the webform submit page can be accessed. Any value entered here will overwrite ALL aliases you may have created for this form via the path module. The URL alias has to start with a slash and cannot end with a slash.
Defaults to:
/form/YOUR-WEBFORM-ID
This finally leads me to https://example.com/admin/config/search/path/patterns/add where I also can add a pattern for Webforms:
/form
prefix is the default. I added that to the answer. Maybe OP has a project where the default already got changed.