This PR is a proof of concept to use ACF + ACF Blocks Toolkit to create a set of blocks that can be used create forms.
Proof of Concept Features
Form block (wrapper): Defaults to 1 input field and submit button as initial template.
Input Field: Supports Types Text, Email, URL, Phone, Password, Number, Date, Time, Date/Time, Hidden, and Color Picker
Textarea Field: Input Fields, Select Fields, and Textarea Fields support placeholder text.
Select Field: Basic Options support, with default selected value.
Fieldset: A way to group fields together (such as Address Fields)
Checkboxes: Single and grouped fields
Radio Buttons: Alternative to select field.
Validation: Basic required validation is supported with error messages
Confirmation: Custom Message and Redirect support.
Submission Storage: Form submissions are stored in a custom post type (JSON format)
Email Notifications: Option for 3 Notifications (Admin, Confirmation, Custom) with customizable templates.
Custom templates can be built using the Form Data and Form Meta blocks, which allow you to place form fields or meta anywhere in a standard Gutenberg editor.
Super basic styling (with vanilla CSS for speed)
Currently everything is in PHP, so just about anything can be customized via hooks.
Known Issues
[Optimization] There is some code duplication and areas where code can be optimized/refactored.
[Bug] I've noticed rare instances where the Custom Unique Block IDs (ACF Blocks Toolkit) change, causing the blocks (and forms) to lose connection with anything associated with it (such as Email Templates and Conditional Logic) - I have been unable to reproduce, so maybe this is expected during experimental development This has been addressed in PR #140
[Enhancement] Currently the block contains an innerBlocks section and the "field", which doesn't really allow for support of a connected set of blocks below the "field". A potential solution is to create a Label field which serves as the innerBlocks area above the input, and the rest of the blocks can be placed below.
[Bug] When you provide a custom label for the Form Data or Form Meta blocks, they don't render in the Email Template (the default Label will display).
Issues
N/A
Testing Instructions
Check out the bd/block-forms branch
Add a form to any page
Submit that form
Screenshots
Default Form Template
Demo Form Front-end
Demo Form Back-end
Form Submission Confirmation Message
Form Submissions Page
Email Templates
Future
I'm proposing we move this project into a separate repository so it can be managed as its own plugin, tested and QA'd, with the potential of an initial release of a basic, bare minimum functioning version.
Potential Enhancements
AJAX Submissions
Plugin Settings Page
API Add-on (for transmitting data to third parties)
Summary
This PR is a proof of concept to use ACF + ACF Blocks Toolkit to create a set of blocks that can be used create forms.
Proof of Concept Features
default
selected value.Form Data
andForm Meta
blocks, which allow you to place form fields or meta anywhere in a standard Gutenberg editor.Known Issues
[Bug] I've noticed rare instances where the Custom Unique Block IDs (ACF Blocks Toolkit) change, causing the blocks (and forms) to lose connection with anything associated with it (such as Email Templates and Conditional Logic) - I have been unable to reproduce, so maybe this is expected during experimental developmentThis has been addressed in PR #140innerBlocks
section and the "field", which doesn't really allow for support of a connected set of blocks below the "field". A potential solution is to create aLabel
field which serves as theinnerBlocks
area above the input, and the rest of the blocks can be placed below.Form Data
orForm Meta
blocks, they don't render in the Email Template (the default Label will display).Issues
Testing Instructions
bd/block-forms
branchScreenshots
Default Form Template
Demo Form Front-end
Demo Form Back-end
Form Submission Confirmation Message
Form Submissions Page
Email Templates
Future
I'm proposing we move this project into a separate repository so it can be managed as its own plugin, tested and QA'd, with the potential of an initial release of a basic, bare minimum functioning version.
Potential Enhancements