Third Party Templates
Developers want to be able to create their own form templates. This should be possible and the method modeled.
marked this post as
I want to pop in here and be transparent with where we're at as well as our plans.
First, where we're at. Presently, all forms (regardless of template) are rendered exactly the same in GiveWP. The markup is rendered on the server and then sent to the browser. This is also true when gateways are rendered (markup fetched by the server). Frankly, this makes custom templates very hard. The Multi-Step template (and the Classic template we're finishing now) are a complicated mix of hooks, heavy CSS, and JS to achieve the final look (and keep it performant). This is too complicated. Documenting it would be a nightmare and would make for a frustrating DX.
Now, where we're going! In 2022 one of our primary goals is to completely rebuild the form rendering engine in GiveWP. We've actually already begun this with the introduction of the Fields API. Basically, all forms will be represented in an abstract structure and then passed to the Form Template. What does this mean? It means that form templates can have completely unique markup and appearance without butting into each other. The same form could even be represented in multiple places using different templates. We'll also be switching our templates to be built in React and will have various hooks and such to take common things such as validation, gateway functionality, and so forth easy to implement. This is the point at which we'd be able to provide some excellent documentation for 3rd party developers. We're even making a completely new way (right now!) to build custom gateways that's soooo much simpler. Improving the DX for 3rd party developers is on the front of our minds.
So, it is possible to make a custom for template now. The best way to do it is honestly to look in the GiveWP code and see how the Multi-Step (and soon Classic) templates are done. I warn you it's not for the faint of heart, but it can be done. We're excited to be building the foundation for a vastly greater DX in the future. It's not theoretical, we're doing it right now!
Thanks so much! Voting on this helps to reinforce its importance to us, so please keep voting!
marked this post as
This would be a useful feature for us, for instance separating out custom form fields or Gift Aid into a separate step. That would help highlight those questions more for the donor, and also reduce the length of each step to improve UX in case of long forms.