Front-end form support in testing

We are currently working on front-end ACF form support! The solution includes all the acf_register_form() or acf_form() settings, and that means ability to either update or create a new post. As of November 10, we have a working test where a post or a page can be created from a form.

The solution includes an ACF Engine Object Type (ACFG Form) which means an abstract class that can be extended programmatically to create ACF forms. There is of course a UX form editor with all the settings available to setup a form. In case you’re interested in how this works internally when you save a new form, it is stored as JSON, then it is registered using acf_register_form(). This does not render the form, it just handles a kind of setup so that the form can later be rendered easily using acf_form( $formId ).

To render your ACF Engine forms you’ll use the provided Gutenberg block “form”. Simply enter the form key that you used when setting up the form, the form will then render and work according to the settings in the UX.

Forms can be migrated (imported and exported) between sites as with all ACF Engine Object Types simply by moving the JSON file into the save folder which for forms is:

/wp-content/uploads/acfengine/forms/

As this feature is still under active development there is certainly more testing to do on edge case features, and also more thought given to extra features beyond what ACF provides. We are thinking for instance with create/edit posts, how could we support setting the post title and content from an ACF field? Because acf_form() arguments enable us to use any of the WP insert_post or update_post arguments, but these have to be set as arguments. So we’ll be looking at how we might provide a UX to say “set the title according to this field in my form”. Hope that makes sense, it’s a feature we can see needing/wanting that doesn’t seem to be natively supported with the ACF settings.

Leave a Reply