Third Party Templates
planned
Ben Meredith
Developers want to be able to create their own form templates. This should be possible and the method modeled.
Jason Adams
planned
Hi All!
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!
Jason Adams
planned
Hi All!
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!
R
Rik
Jason Adams: Hi, this sounds like a great development. Could you please take into account in your development:
- Give a ‘global’ vs custom choice for any field for which that might possibly make sense (this saves tons of time for platforms like us who work with a lot of forms) https://feedback.givewp.com/feature-requests/p/more-global-settings-on-form-template-and-donation-options-tabs
- Possibility for multiple global options would be great https://feedback.givewp.com/feature-requests/p/multiple-global-options
- Please support multilingual (we use Polylang)
- Please make it possible for site admins with little development experience to duplicate and edit multistep form templates – not to be able the layout for example, but just the texts on the form. This would be really helpful for us, we have several types of forms, and this would allow us to make a template for each form type ourselves and apply it.
W
Waleed Zuberi
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.