Recently I was asked by an architect at a client to prove a persistent Gravity Forms form could be added programmatically with the possibility to maintain sorting and renaming labels of fields.
I’m sharing the basic proof of concept on how to programmatically add Gravity Forms for other developers because there is very little to be found on the topic. The code is by no means complete, the DocBlocks are there but they’re just the default automatically generated ones and the methods could be better. Alas, thats how quick PoCs tend to go.
I’ve posted the code as a Gist. Be my guest to use it. If there’s interest for it I’ll setup a Github repo.
The code is in form of a small plugin that provides a class to throw an array at. Here’s how you would do that: