Hi,
I finally found a way.
I exported all forms in json from the dev site and put the file in the plugin.
I’m using the acfe function acfe_import_form($args) to import forms on my plugin activation.
I’m running something like that (inside my plugin class) :
$acfe_forms_file = self::get_plugin_dir() . "acfe_forms_settings.json";
if ( file_exists( $acfe_forms_file ) && function_exists( 'acfe_import_form' ) ) {
acfe_import_form( file_get_contents( $acfe_forms_file ) );
}
Hello,
Thanks for the feedback!
Yes, this is the good way to import a Form from PHP. Note that you should make sure to only run this function one time, to avoid importing and importing again the same form.
In a future version of ACF Extended, you’ll be able to register forms in PHP only, making it more versatile. This new version is still work in progress, but we’re not so far from release. I can’t give ETA yet tho.
Have a nice day!
Regards.
Hello Konrad,
good to know for registering forms from PHP in the future 😉
I’m running the import only on my plugin activation using register_activation_hook().
Have a nice day too.
Best regards.
Joffrey