TransWikia.com

Webform variants as blocks

Drupal Answers Asked by LordAro on October 26, 2021

Drupal 8.9, Webforms 5.x

I have a load of forms that are all basically the same, except for the confirmation URL (a download link, essentially) and some minor tweaks to the handlers.

In an effort to reduce duplication, I’ve been looking into the possibility of using variants for this. I can create all the variants easily enough, but I’m at a loss as to how to include these on the correct pages.

The form itself is included in the layout of the content type as a block and I can specify a specific variant there via default submission data (as per image) but that’s a single variant for the whole content type rather than a specific variant for a single page.

enter image description here

What’s the best way to do this? Is it actually possible with variants at all? Or perhaps there’s some other solution I’ve missed

2 Answers

So the eventual answer wasn't variants at all, but webform nodes. Inserting a webform block into the content type's layout enabled me to use the [webform-submission:source-entity:foo] tokens, which were exactly what I wanted.

Important to note that you have to enable the "Webforms Node" extension for this (I've not seen this mentioned anywhere, so was confused about where the "References" tab was)

Answered by LordAro on October 26, 2021

You could create a hidden redirect URL element, which is then used as the confirmation redirect URL. The hidden redirect URL element can be populated using the 'Default webform submission data.'

Answered by jrockowitz on October 26, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP