Contact Form 7 - Replace database configured form template with a static file
TL;DR - Is there a way CF7 can pull it's form markup and tags from a static file, instead of the database? So I can maintain that file in version control.
We have a very complex form running under Contact Form 7. It has branching, logic and more, all handled by custom code using hooks and filters. However we still have to copy and paste the (thousands of lines) of code that describes this form into the form editor in the Wordpress admin panel if the form is changed. We would never edit it there though, it'd be impossible, and in fact we keep this form as a static file, so we can version it. So we rely on the fact that the form in the database matches this static file at all times.
It occured to me today - why not cut out the middle-man and simply have CF7 use markup from this file directly? It would be easier to maintain, and stop anyone accidentally damaging the form markup in the editor.
Is such a mechanism available? Many thanks.
I have discovered this: https://medium.com/@deyanyanakiev/embed-contact-form-7-in-your-custom-theme-9e038c494815 a technique to replace the default form on installation, but as I understand it, that would be a one-off operation and would not allow for the form to be updated.
Topic plugin-contact-form-7 php version-control Wordpress
Category Web