5

I have a question about rendering a contact form as a rendered entity. I have a field in my contenttype where form should be displayed. The field has the type Contact form.

Type of reference

In the Manage display section in the contenttype where the field is added i got only the possibility to choose Label, Entity ID or Hidden for the format.

Possible formats

On the page itself i got only a link to the page where the form is embedded. I searched about a solution and got something like loading and handling the form with an own module, loading the form in a hook or create a block.

So are those the only possiblities or is there a way to include the form like another entity reference (where i choose Rendered entity as the format).

1 Answer 1

8

Use https://www.drupal.org/project/contact_storage.

It provides a view builder for contact forms that displays the form.

It also results in contact messages being stored, among many other optional features. If you do not want that, then you can re-use the code from it for the view builder and add it yourself.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.