Enhanced Drupal 8 Contact Forms with Contact Storage
Drupal 8’s improvements to contact form management and creation is one of my favorite site building upgrades that has been added to Drupal 8’s core.
We now have the ability to field contact forms in the same familiar way as many other entities and can have multiple form variations living at different urls on the same site.
- Need a phone number field? Not a problem.
- Want it to be required? Piece of cake.
- Looking to have a RFQ form as well as a contact form? Yup, we got that….all in core!
All of your forms are nicely managed in one place (/admin/structure/contact) and over all it makes for a much improved experience from previous versions of Drupal.
Recently while building a new D8 site I had a request to hide the “preview” button that is shown on all the contact forms. A task most commonly done with a simple form alter but not being a developer I wanted to see if I could do this without any code and not trouble our dev team as they were working on more complicated features.
Enter the Contact Storage module. This little gem offers some really useful enhancements to the already much improved Drupal 8 contact form improvements.
First off it solved my issue of hiding the preview button with a simple check box on the contact form edit screen.
It also allows for a redirect path to be set which is great considering I would have done this with the Rules module in the past, which at the time of this post is still in alpha for D8.
Another nice little feature is the ability to change the text of the submit button….a common request which is now very easily accommodated right in the UI!
As the name suggests the Contact Storage module also provides storage for all the messages submitted through the forms on your site as well as views integration to manage them.
The admin view is configured with the ability to look at all of the submissions at once or filter them by individual forms. The view itself is conviently accessible via a new "List" tab added to the contact form admin screen.
A big thanks to larowlan and all the contributors who helped put this module together and are currently maintaining it.
I have a feeling I will being using this one a lot more in the future!