=== FrontElf Fields Bridge for Contact Form 7 ===
Contributors: frontelf
Tags: custom-fields, forms, form-editor, admin
Requires at least: 6.7
Tested up to: 7.0
Requires PHP: 7.4
Stable tag: 1.0.0
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html
Donate link: https://ko-fi.com/frontelf

Add ACF and SCF field groups to the Contact Form 7 form editor.

== Description ==

FrontElf Fields Bridge for Contact Form 7 provides an ACF and SCF integration for Contact
Form 7. It adds ACF field groups directly to each Contact Form 7 form editor.

The plugin adds the Contact Form 7 form post type to the ACF location rules.
Field groups assigned to that post type are shown in a dedicated tab in the
Contact Form 7 editor and saved together with the form. This allows developers
to store editable metadata and settings for each form.

The plugin supports Advanced Custom Fields and Secure Custom Fields. Contact
Form 7 and one of those field plugins must be installed and active.

== Installation ==

1. Upload the `frontelf-cf7-fields-bridge` directory to `/wp-content/plugins/`.
2. Activate FrontElf Fields Bridge for Contact Form 7 in the WordPress Plugins screen.
3. Follow the steps below to assign fields to Contact Form 7 forms.

== Documentation ==

= Assign fields to Contact Form 7 =

After activating the plugin, a new `Contact Form (CF7)` option appears in the
ACF or SCF field group location rules under `Post Type`.

1. Open the ACF or SCF field group editor.
2. Add the fields that should belong to each Contact Form 7 form.
3. In the location rules, select `Post Type` `is equal to` `Contact Form (CF7)`.
4. Save the field group.
5. Open a Contact Form 7 form and use the `Fields for form` tab.

If no matching field groups exist, the `Fields for form` tab provides a button
to create one.

= Retrieve field values in a theme or plugin =

Each saved Contact Form 7 form has a numeric WordPress post ID. The plugin shows
this ID above the fields in the `Fields for form` tab.

Use the form ID as the second argument of `get_field()`:

`$value = get_field('field_name', 123);`

Escape the returned value according to its output context:

`echo esc_html(get_field('field_name', 123));`

== Screenshots ==

1. The `Contact Form (CF7)` option in ACF or SCF location rules.
2. The custom fields tab in the form editor.
3. Example of retrieving fields by form ID.
4. Example of displaying the result.

== Changelog ==

= 1.0.0 =
* Add ACF and SCF field groups to the Contact Form 7 editor.
* Store editable metadata and settings for each Contact Form 7 form.
* Validate field values before saving a form.
* Copy assigned field values when duplicating a Contact Form 7 form.
* Show a field group creation prompt when no groups are assigned.
