Home / Admin / GravityForms_DIR_AB_ACF – Gravity Forms & Feeds ACF Fields
Duplicate Snippet

Embed Snippet on Your Site

GravityForms_DIR_AB_ACF – Gravity Forms & Feeds ACF Fields

* Description: Registers ACF fields for form and feed data + notification/confirmation content
* Location: Run Everywhere
* Priority: 10

ismail daugherty PRO
<10
Code Preview
php
<?php
/**
 * WPCode Snippet: Gravity Forms & Feeds ACF Fields
 * Description: Registers ACF fields for form and feed data + notification/confirmation content
 * Location: Run Everywhere
 * Priority: 10
 */
defined( 'ABSPATH' ) || exit;
add_action( 'acf/init', function() {
    if ( ! function_exists( 'acf_add_local_field_group' ) ) {
        return;
    }
    acf_add_local_field_group( array(
        'key' => 'group_gf_form_feeds_meta',
        'title' => 'Form & Feed Information',
        'fields' => array(
            // ==========================================
            // TAB 1: FORM OVERVIEW
            // ==========================================
            array(
                'key' => 'field_tab_form_overview',
                'label' => 'Form Overview',
                'name' => '',
                'type' => 'tab',
                'instructions' => '',
                'required' => 0,
                'conditional_logic' => 0,
                'wrapper' => array(
                    'width' => '',
                    'class' => '',
                    'id' => '',
                ),
                'placement' => 'top',
                'endpoint' => 0,
            ),
            
            // ✅ NEW: Quick Access Links
            array(
                'key' => 'field_gf_form_edit_link',
                'label' => '🔗 Edit Form',
                'name' => 'gf_form_edit_link',
                'type' => 'url',
                'instructions' => 'Direct link to edit this form in Gravity Forms admin',
                'required' => 0,
                'conditional_logic' => 0,
                'wrapper' => array(
                    'width' => '50',
                    'class' => '',
                    'id' => '',
                ),
                'default_value' => '',
                'placeholder' => '',
                'prepend' => '',
                'append' => '',
                'maxlength' => '',
                'readonly' => 1,
            ),
            array(
                'key' => 'field_gf_form_entries_link',
                'label' => '📋 View Entries',
                'name' => 'gf_form_entries_link',
                'type' => 'url',
                'instructions' => 'Direct link to view entries for this form',
                'required' => 0,
                'conditional_logic' => 0,
                'wrapper' => array(
                    'width' => '50',
                    'class' => '',
                    'id' => '',
                ),
                'default_value' => '',
                'placeholder' => '',
                'prepend' => '',
                'append' => '',
                'maxlength' => '',
                'readonly' => 1,
            ),
            
            // Form Basic Info
            array(
                'key' => 'field_gf_form_id',
                'label' => 'Form ID',
                'name' => 'form_id',
                'type' => 'number',
                'instructions' => '',
                'required' => 0,
                'conditional_logic' => 0,
                'wrapper' => array(
                    'width' => '25',
                    'class' => '',
                    'id' => '',
                ),
                'default_value' => '',
                'placeholder' => '',
                'prepend' => '',
                'append' => '',
                'min' => '',
                'max' => '',
                'step' => '',
                'readonly' => 1,
            ),
            array(
                'key' => 'field_gf_form_status',
                'label' => 'Status',
                'name' => 'form_status',
                'type' => 'select',
                'instructions' => '',
                'required' => 0,
                'conditional_logic' => 0,
                'wrapper' => array(
                    'width' => '25',
                    'class' => '',
                    'id' => '',
                ),
                'choices' => array(
                    'active' => 'Active',
                    'inactive' => 'Inactive',
                    'trash' => 'Trash',
                ),
                'default_value' => false,
                'allow_null' => 0,
                'multiple' => 0,
                'ui' => 0,
                'return_format' => 'value',
                'ajax' => 0,
                'placeholder' => '',
                'disabled' => 1,
                'readonly' => 1,
            ),
            array(
                'key' => 'field_gf_form_entries',
                'label' => 'Total Entries',
                'name' => 'entry_count',
                'type' => 'number',
                'instructions' => '',
                'required' => 0,
                'conditional_logic' => 0,
                'wrapper' => array(
                    'width' => '25',
                    'class' => '',
                    'id' => '',
                ),
                'default_value' => 0,
                'placeholder' => '',
                'prepend' => '',
                'append' => '',
                'min' => '',
                'max' => '',
                'step' => '',
                'readonly' => 1,
            ),
            array(
                'key' => 'field_gf_field_count',
                'label' => 'Field Count',
                'name' => 'field_count',
                'type' => 'number',
                'instructions' => '',
                'required' => 0,
                'conditional_logic' => 0,
                'wrapper' => array(
                    'width' => '25',
                    'class' => '',
                    'id' => '',
                ),
                'default_value' => 0,
                'placeholder' => '',
                'prepend' => '',
                'append' => '',
                'min' => '',
                'max' => '',
                'step' => '',
                'readonly' => 1,
            ),
            // Feed Summary
            array(
                'key' => 'field_gf_feed_count_total',
                'label' => 'Total Feeds',
                'name' => 'feed_count_total',
                'type' => 'number',
                'instructions' => '',
                'required' => 0,
                'conditional_logic' => 0,
                'wrapper' => array(
                    'width' => '33',
                    'class' => '',
                    'id' => '',
                ),
                'default_value' => 0,
                'placeholder' => '',
                'prepend' => '',
                'append' => '',
                'min' => '',
                'max' => '',
                'step' => '',
                'readonly' => 1,
            ),
            array(
                'key' => 'field_gf_feed_count_active',
                'label' => 'Active Feeds',
                'name' => 'feed_count_active',
                'type' => 'number',
                'instructions' => '',
                'required' => 0,
                'conditional_logic' => 0,
                'wrapper' => array(
                    'width' => '33',
                    'class' => '',
                    'id' => '',
                ),
                'default_value' => 0,
                'placeholder' => '',
                'prepend' => '',
                'append' => '',
                'min' => '',
                'max' => '',
                'step' => '',
                'readonly' => 1,
            ),
            array(
                'key' => 'field_gf_feed_count_inactive',
                'label' => 'Inactive Feeds',
                'name' => 'feed_count_inactive',
                'type' => 'number',
                'instructions' => '',
                'required' => 0,
                'conditional_logic' => 0,
                'wrapper' => array(
                    'width' => '34',
                    'class' => '',
                    'id' => '',
                ),
                'default_value' => 0,
                'placeholder' => '',
                'prepend' => '',
                'append' => '',
                'min' => '',
                'max' => '',
                'step' => '',
                'readonly' => 1,
            ),
            // Feed Details Repeater
            array(
                'key' => 'field_gf_feeds_list',
                'label' => 'Feed Details',
                'name' => 'feeds_list',
                'type' => 'repeater',
                'instructions' => '',
                'required' => 0,
                'conditional_logic' => 0,
                'wrapper' => array(
                    'width' => '',
                    'class' => '',
                    'id' => '',
                ),
                'collapsed' => '',
                'min' => 0,
                'max' => 0,
                'layout' => 'table',
                'button_label' => 'Add Feed',
                'sub_fields' => array(
                    array(
                        'key' => 'field_feed_addon',
                        'label' => 'Add-on',
                        'name' => 'addon',
                        'type' => 'text',
                        'instructions' => '',
                        'required' => 0,
                        'conditional_logic' => 0,
                        'wrapper' => array(
                            'width' => '25',
                            'class' => '',
                            'id' => '',
                        ),
                        'default_value' => '',
                        'placeholder' => '',
                        'prepend' => '',
                        'append' => '',
                        'maxlength' => '',
                    ),
                    array(
                        'key' => 'field_feed_name',
                        'label' => 'Feed Name',
                        'name' => 'name',
                        'type' => 'text',
                        'instructions' => '',
                        'required' => 0,
                        'conditional_logic' => 0,
                        'wrapper' => array(
                            'width' => '35',
                            'class' => '',
                            'id' => '',
                        ),
                        'default_value' => '',
                        'placeholder' => '',
                        'prepend' => '',
                        'append' => '',
                        'maxlength' => '',
                    ),
                    array(
                        'key' => 'field_feed_type',
                        'label' => 'Type',
                        'name' => 'type',
                        'type' => 'text',
                        'instructions' => '',
                        'required' => 0,
                        'conditional_logic' => 0,
                        'wrapper' => array(
                            'width' => '20',
                            'class' => '',
                            'id' => '',
                        ),
                        'default_value' => '',
                        'placeholder' => '',
                        'prepend' => '',
                        'append' => '',
                        'maxlength' => '',
                    ),
                    array(
                        'key' => 'field_feed_active',
                        'label' => 'Active',
                        'name' => 'is_active',
                        'type' => 'true_false',
                        'instructions' => '',
                        'required' => 0,
                        'conditional_logic' => 0,
                        'wrapper' => array(
                            'width' => '20',
                            'class' => '',
                            'id' => '',
                        ),
                        'message' => '',
                        'default_value' => 0,
                        'ui' => 1,
                        'ui_on_text' => '',
                        'ui_off_text' => '',
                    ),
                ),
            ),
            // Form Settings Group
            array(
                'key' => 'field_gf_form_settings',
                'label' => 'Form Settings',
                'name' => 'form_settings',
                'type' => 'group',
                'instructions' => '',
                'required' => 0,
                'conditional_logic' => 0,
                'wrapper' => array(
                    'width' => '',
                    'class' => '',
                    'id' => '',
                ),
                'layout' => 'block',
                'sub_fields' => array(
                    array(
                        'key' => 'field_setting_ajax',
                        'label' => 'AJAX Enabled',
                        'name' => 'ajax_enabled',
                        'type' => 'true_false',
                        'instructions' => '',
                        'required' => 0,
                        'conditional_logic' => 0,
                        'wrapper' => array(
                            'width' => '25',
                            'class' => '',
                            'id' => '',
                        ),
                        'message' => '',
                        'default_value' => 0,
                        'ui' => 1,
                        'ui_on_text' => '',
                        'ui_off_text' => '',
                    ),
                    array(
                        'key' => 'field_setting_honeypot',
                        'label' => 'Honeypot Enabled',
                        'name' => 'honeypot_enabled',
                        'type' => 'true_false',
                        'instructions' => '',
                        'required' => 0,
                        'conditional_logic' => 0,
                        'wrapper' => array(
                            'width' => '25',
                            'class' => '',
                            'id' => '',
                        ),
                        'message' => '',
                        'default_value' => 0,
                        'ui' => 1,
                        'ui_on_text' => '',
                        'ui_off_text' => '',
                    ),
                    array(
                        'key' => 'field_setting_save_continue',
                        'label' => 'Save & Continue',
                        'name' => 'save_continue',
                        'type' => 'true_false',
                        'instructions' => '',
                        'required' => 0,
                        'conditional_logic' => 0,
                        'wrapper' => array(
                            'width' => '25',
                            'class' => '',
                            'id' => '',
                        ),
                        'message' => '',
                        'default_value' => 0,
                        'ui' => 1,
                        'ui_on_text' => '',
                        'ui_off_text' => '',
                    ),
                    array(
                        'key' => 'field_setting_limit_entries',
                        'label' => 'Limit Entries',
                        'name' => 'limit_entries',
                        'type' => 'true_false',
                        'instructions' => '',
                        'required' => 0,
                        'conditional_logic' => 0,
                        'wrapper' => array(
                            'width' => '25',
                            'class' => '',
                            'id' => '',
                        ),
                        'message' => '',
                        'default_value' => 0,
                        'ui' => 1,
                        'ui_on_text' => '',
                        'ui_off_text' => '',
                    ),
                ),
            ),
            // Notification & Confirmation Counts
            array(
                'key' => 'field_gf_notification_count',
                'label' => 'Notifications',
                'name' => 'notification_count',
                'type' => 'number',
                'instructions' => '',
                'required' => 0,
                'conditional_logic' => 0,
                'wrapper' => array(
                    'width' => '50',
                    'class' => '',
                    'id' => '',
                ),
                'default_value' => 0,
                'placeholder' => '',
                'prepend' => '',
                'append' => '',
                'min' => '',
                'max' => '',
                'step' => '',
                'readonly' => 1,
            ),
            array(
                'key' => 'field_gf_confirmation_count',
                'label' => 'Confirmations',
                'name' => 'confirmation_count',
                'type' => 'number',
                'instructions' => '',
                'required' => 0,
                'conditional_logic' => 0,
                'wrapper' => array(
                    'width' => '50',
                    'class' => '',
                    'id' => '',
                ),
                'default_value' => 0,
                'placeholder' => '',
                'prepend' => '',
                'append' => '',
                'min' => '',
                'max' => '',
                'step' => '',
                'readonly' => 1,
            ),
            // ✅ NEW: Notification Content
            array(
                'key' => 'field_gf_notifications_content',
                'label' => 'Notification Details',
                'name' => 'notifications_content',
                'type' => 'textarea',
                'instructions' => 'Complete notification configurations including subjects, messages, and recipients.',
                'required' => 0,
                'conditional_logic' => 0,
                'wrapper' => array(
                    'width' => '',
                    'class' => 'field-details-monospace',
                    'id' => '',
                ),
                'default_value' => '',
                'placeholder' => 'Notification details will appear here after sync...',
                'maxlength' => '',
                'rows' => 15,
                'new_lines' => '',
                'readonly' => 1,
            ),
            // ✅ NEW: Confirmation Content
            array(
                'key' => 'field_gf_confirmations_content',
                'label' => 'Confirmation Details',
                'name' => 'confirmations_content',
                'type' => 'textarea',
                'instructions' => 'Complete confirmation configurations including messages, redirects, and page content.',
                'required' => 0,
                'conditional_logic' => 0,
                'wrapper' => array(
                    'width' => '',
                    'class' => 'field-details-monospace',
                    'id' => '',
                ),
                'default_value' => '',
                'placeholder' => 'Confirmation details will appear here after sync...',
                'maxlength' => '',
                'rows' => 15,
                'new_lines' => '',
                'readonly' => 1,
            ),
            // Last Sync
            array(
                'key' => 'field_gf_last_sync',
                'label' => 'Last Synced',
                'name' => 'last_sync',
                'type' => 'date_time_picker',
                'instructions' => '',
                'required' => 0,
                'conditional_logic' => 0,
                'wrapper' => array(
                    'width' => '',
                    'class' => '',
                    'id' => '',
                ),
                'display_format' => 'F j, Y g:i a',
                'return_format' => 'Y-m-d H:i:s',
                'first_day' => 1,
                'readonly' => 1,
            ),
            // ==========================================
            // TAB 2: FIELD DETAILS
            // ==========================================
            array(
                'key' => 'field_tab_field_details',
                'label' => 'Field Details',
                'name' => '',
                'type' => 'tab',
                'instructions' => '',
                'required' => 0,
                'conditional_logic' => 0,
                'wrapper' => array(
                    'width' => '',
                    'class' => '',
                    'id' => '',
                ),
                'placement' => 'top',
                'endpoint' => 0,
            ),
            // Field Details Textarea
            array(
                'key' => 'field_gf_field_details_list',
                'label' => 'Complete Field Information',
                'name' => 'field_details_list',
                'type' => 'textarea',
                'instructions' => 'Comprehensive field data synced automatically. Includes: ID, Label, Type, Description, Required, Visibility, Dynamic Population, GPPA Settings, and Additional Properties. Syncs with WhalSync for Airtable integration.',
                'required' => 0,
                'conditional_logic' => 0,
                'wrapper' => array(
                    'width' => '',
                    'class' => 'field-details-monospace',
                    'id' => '',
                ),
                'default_value' => '',
                'placeholder' => 'Field details will appear here after sync...',
                'maxlength' => '',
                'rows' => 25,
                'new_lines' => '',
            ),
            // Field Details Last Sync
            array(
                'key' => 'field_gf_field_details_last_sync',
                'label' => 'Field Details Last Synced',
                'name' => 'field_details_last_sync',
                'type' => 'date_time_picker',
                'instructions' => '',
                'required' => 0,
                'conditional_logic' => 0,
                'wrapper' => array(
                    'width' => '50',
                    'class' => '',
                    'id' => '',
                ),
                'display_format' => 'F j, Y g:i a',
                'return_format' => 'Y-m-d H:i:s',
                'first_day' => 1,
                'readonly' => 1,
            ),
        ),
        'location' => array(
            array(
                array(
                    'param' => 'post_type',
                    'operator' => '==',
                    'value' => 'gf_form_feeds',
                ),
            ),
        ),
        'menu_order' => 0,
        'position' => 'acf_after_title',
        'style' => 'default',
        'label_placement' => 'top',
        'instruction_placement' => 'label',
        'hide_on_screen' => array(
            0 => 'the_content',
            1 => 'excerpt',
            2 => 'featured_image',
            3 => 'discussion',
            4 => 'comments',
            5 => 'revisions',
            6 => 'slug',
            7 => 'author',
            8 => 'format',
            9 => 'page_attributes',
            10 => 'categories',
            11 => 'tags',
        ),
        'active' => true,
        'description' => '',
        'show_in_rest' => 1,
    ) );
} );
/**
 * Add custom CSS for monospace field display
 */
add_action( 'acf/input/admin_head', function() {
    ?>
    <style>
        .field-details-monospace textarea {
            font-family: 'Courier New', Courier, monospace !important;
            font-size: 12px !important;
            line-height: 1.6 !important;
            background: #f8f9fa !important;
            border: 1px solid #ddd !important;
            padding: 15px !important;
        }
    </style>
    <?php
} );

Comments

Add a Comment