I'm not sure if this is the purpose of this module but since the Form Block module hasn't been updated in about a year, I thought I would give this one a shot.

Currently it doesn't appear to be working when I try to render my contact form as a block and it throws a bunch of PHP warnings. Is it a goal of this module to provide the ability to render contact forms as blocks too? If so, I'll see if I can lend a hand getting it to work.

Thanks,
Andrew

Comments

awasson created an issue. See original summary.

eme’s picture

Title: Rendering contact form as block » Rendering default contact form as block

Hello !

Yes, exactly. The objective is to be able to call any content entity form (contact included). With contact, it works well it seems if you create a new contact bundle. But with the default one that you cannot delete, it doesn't work. It seems there is something special with it...

eme’s picture

Hum of course. What did you try exactly ? If you try with the personnal contact form, it cannot work by default since the ID of the user is requiered (same for comment as a matter of fact).

But with the feedback form or any new bundle, it works well. Beware, use Contact message and not contact form which is I think the config entity form.

awasson’s picture

Thanks. Initially I was trying it with a contact form I had created. It wasn't the default one, just a secondary feedback form I created. I've got CTools installed which adds a bunch of additional options for blocks and although it looks like it should provide the option to render a system contact form, it doesn't seem to work either.

In the end, I found that with the D8 block system I was able to do it right out of the box by creating a custom block type, with an entity reference field, referencing Drupal's contact forms and set Display Settings to display the rendered entity -> Rendered as Default. From there on in, I created a block and pointed it to the form I wanted to render. It worked perfectly.

Thanks again for the follow up.

Andrew

eme’s picture

I must say I couldn't reproduce this with core. You say you add a entity reference of type "Contact form" to a block and when you fill it you get the form ? As display I only get "label" or "ID"...

awasson’s picture

You will only get the label if you have the Display Settings set to the default settings. In your custom (form) block type, go to Display Settings and set it to display the rendered entity. In my case the setting to show the form is: "Rendered as Default"

awasson’s picture

A little follow up for clarity. You are 100% correct that with core you can only display the label or form id.

I discovered that the reason I can render the form in my custom block type as a rendered entity is because this is an option that was added by the Contact Storage module that I have added to my site: https://www.drupal.org/project/contact_storage

Without the contact storage module, I can only render a label as you described in post #5. Once I added the Contact Storage module I had the option to display the form as a rendered entity as well as by label and form id.

Sorry for the confusion.

Andrew

eme’s picture

Title: Rendering default contact form as block » Rendering personnal contact form as block

Thank you very much for this clarification ! I tested again entity form block with contact form and it works with the default contact form entity, as well as new contact form bundle. If you get an error, maybe it is due to contact storage (?).

But it does not work with a personnal contact form as it needs to get the recipient which is not defined in the block configuration.

I change therefore the title of this ticket.

awasson’s picture

Thanks eme,
I'll do some more testing locally to see if one of the other modules I'm using was interfering with Entity Forms in Blocks.

Andrew

eme’s picture

Status: Active » Closed (fixed)