Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[N/A] ACF Block Forms (Concept) #120

Open
wants to merge 69 commits into
base: main
Choose a base branch
from
Open

[N/A] ACF Block Forms (Concept) #120

wants to merge 69 commits into from

Conversation

bd-viget
Copy link
Contributor

@bd-viget bd-viget commented Jul 2, 2024

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

  • 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 [N/A] Prevent Block IDs from Changing #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

  1. Check out the bd/block-forms branch
  2. Add a form to any page
  3. Submit that form

Screenshots

Default Form Template
Screenshot 2024-07-02 at 10 42 41 AM

Demo Form Front-end
Screenshot 2024-07-02 at 10 39 15 AM

Demo Form Back-end
Screenshot 2024-07-02 at 10 42 02 AM

Form Submission Confirmation Message
Screenshot 2024-07-02 at 10 52 00 AM

Form Submissions Page
Screenshot 2024-07-02 at 10 41 30 AM

Email Templates
Screenshot 2024-07-30 at 6 50 05 AM

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)
  • Multi-file Upload and Restricted file types
  • More Validation options
  • Multi-page Support (Steps)

@bd-viget bd-viget self-assigned this Jul 2, 2024
Copy link
Contributor

@ten1seven ten1seven left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

😎

@bd-viget bd-viget marked this pull request as ready for review July 30, 2024 11:43
@bd-viget bd-viget force-pushed the bd/block-forms branch 2 times, most recently from c935d24 to d067a46 Compare July 31, 2024 14:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants