The webform module has available as block
as an option, but there doesn't seem to be a way to create a custom block from a webform.
Webforms can be added in layouts as blocks, but there seems to be no way of adding them directly into pages.
I have seen the block embed module which enables embedding blocks in pages, but I have to create the block first. The only way I can think of is to create a layout with a single region, configure a block in that single region and embed the layout within a page, but it appears to be too much of roundabout approach. In any case is it possible to embed a layout within a page?
I have also tried to create a custom block which uses the filter text [webform: block_id], but that doesn't work as well.
Is there some other technique or module for achieving this, ie create a custom block directly from a webform?
Comments
Hi @vonhabsi, if I understand your use case correctly, I'd suggest to add the webform to the layout that is responsible for your page, and to add a "visibility condition" to this block, e.g. an "URL path" condition ("Allow access on the following pages" > PATH-OF-YOUR-PAGE).
My aim is to insert the block at any place with the page or the node's text, as it is done with Drupal's Insert Block module, but it doesn't look like there is something like that available for Backdrop yet.
With respect to your suggestion I have that part working, but I'm not even sure I'm doing the right thing. I have it working with the Default Layout, and I am creating the CSS to hide the title, the creator and time etc.
But how do I associate a page exclusively with a layout?
Have you seen https://backdropcms.org/project/block_embed? I didn't test it but it might be a good option for your use case. (Also interesting but for different use cases: https://backdropcms.org/project/blockreference.)
On the block configuration form, you should be able to hide the block title if you want (Block title type: None) and to only show the form instead of the whole webform node (View mode: Form only).
Not sure if it helps: You can add a new layout, fill in "Path: node/%", then choose the node ID of your page as visibility condition for this layout. As a result, this specific layout is only used on the page with the chosen node ID.