Back in 2018, I created a small plugin to create repeatable fields in Contact Form 7. I learned a lot of different things with it and it was one of the code samples I sent during the 10up recruiting process. I even remember staying up all night to make it more presentable!
I was hired by 10up, the pandemic hit and I never went back to the plugin. A few people reached out asking, but it just wasn’t on my radar anymore. Recently, an update to Contact Form 7 broke the repeated fields validation and I decided it was time to go back.
Even if I tried, I can’t explain how much I’ve learned over the last few years, mostly leading ElasticPress development. As free time is rare, I decided to implement the most basic things first and release a new version of my plugin.
In addition to fixing that validation error, this version changes a few other things. For me, the main ones are:
- Unit tests: for now it only has a very basic test, but the most important thing is that the foundation is already there, running the tests at each commit of a Pull Request. Now it’s just a matter of writing more tests.
- Better documentation: in this version, I moved the documentation to GitHub’s Wiki. In the near future, part of it will be automatically generated from comments in the code.
- Support: I’ve decided that I will only offer support on GitHub. I created new templates for issues, forcing users who want to report a bug to provide plugin-specific data.
- Script minification: the plugin only has a .js file, which was previously minified with Grunt. I switched to wp-scripts instead.
In the near future, I also intend to implement end-to-end tests, probably using Cypress. For this, I’ve added support for wp-env already.
The version wasn’t even released and I already have a regret: as I did a lot of things in a hurry and alone, I ended up committing some things mixed up and directly on the trunk branch. Then I tried to be more disciplined and open Pull Requests, but I didn’t have the patience to document everything properly. As the basics are already done, from now on it will be easier to do it right 😉
For those who want to check it out, the plugin repository is at https://github.com/felipeelia/cf7-repeatable-fields.