Home / Admin / Gravity Flow ACF
Duplicate Snippet

Embed Snippet on Your Site

Gravity Flow ACF

Acf Fields to show Gravity Flow Parameters

ismail daugherty PRO
<10
Code Preview
php
<?php
/**
 * Registers the "Gravity Flow Step Meta" field group on gf_workflow_step posts.
 */
defined( 'ABSPATH' ) || exit;
add_action( 'acf/init', function () {
    if ( ! function_exists( 'acf_add_local_field_group' ) ) {
        return;
    }
    
    acf_add_local_field_group( [
        'key'      => 'group_gf_workflow_step_meta',
        'title'    => 'Gravity Flow Step Meta',
        'location' => [
            [ [ 'param' => 'post_type', 'operator' => '==', 'value' => 'gf_workflow_step' ] ],
        ],
        'fields'   => [
            // Form Information
            [
                'key'     => 'gf_flow_form_id',
                'label'   => 'Form ID',
                'name'    => 'form_id',
                'type'    => 'number',
                'readonly' => 1,
                'wrapper' => [ 'width' => '20%' ]
            ],
            [
                'key'     => 'gf_flow_form_title',
                'label'   => 'Form Title',
                'name'    => 'form_title',
                'type'    => 'text',
                'readonly' => 1,
                'wrapper' => [ 'width' => '80%' ]
            ],
            
            // Step Information
            [
                'key'     => 'gf_flow_step_id',
                'label'   => 'Step ID',
                'name'    => 'step_id',
                'type'    => 'text',
                'readonly' => 1,
                'wrapper' => [ 'width' => '25%' ]
            ],
            [
                'key'     => 'gf_flow_step_name',
                'label'   => 'Step Name',
                'name'    => 'step_name',
                'type'    => 'text',
                'readonly' => 1,
                'wrapper' => [ 'width' => '50%' ]
            ],
            [
                'key'     => 'gf_flow_step_order',
                'label'   => 'Order',
                'name'    => 'step_order',
                'type'    => 'number',
                'readonly' => 1,
                'wrapper' => [ 'width' => '25%' ]
            ],
            
            // Step Type and Status
            [
                'key'     => 'gf_flow_step_type',
                'label'   => 'Step Type',
                'name'    => 'step_type',
                'type'    => 'select',
                'choices' => [
                    'approval'          => 'Approval',
                    'user_input'        => 'User Input',
                    'notification'      => 'Notification',
                    'assign_user'       => 'Assign User',
                    'update_entry'      => 'Update Entry',
                    'update_user'       => 'Update User',
                    'webhook'           => 'Outgoing Webhook',
                    'form_submission'   => 'Form Submission',
                    'delete_entry'      => 'Delete Entry',
                    'conversation'      => 'Conversation',
                    'delay'             => 'Delay',
                    'generate_pdf'      => 'Generate PDF',
                    'user_registration' => 'User Registration',
                    'custom'            => 'Custom Step'
                ],
                'readonly' => 1,
                'wrapper' => [ 'width' => '50%' ]
            ],
            [
                'key'     => 'gf_flow_is_active',
                'label'   => 'Active?',
                'name'    => 'is_active',
                'type'    => 'true_false',
                'ui'      => 1,
                'readonly' => 1,
                'wrapper' => [ 'width' => '50%' ]
            ],
            
            // Assignees and Routing
            [
                'key'     => 'gf_flow_assignees',
                'label'   => 'Assignees',
                'name'    => 'assignees',
                'type'    => 'textarea',
                'rows'    => 3,
                'readonly' => 1,
                'instructions' => 'Users/roles assigned to this step'
            ],
            [
                'key'     => 'gf_flow_routing',
                'label'   => 'Routing Logic',
                'name'    => 'routing_logic',
                'type'    => 'textarea',
                'rows'    => 3,
                'readonly' => 1,
                'instructions' => 'Conditional routing rules'
            ],
            
            // Timing and Scheduling
            [
                'key'     => 'gf_flow_scheduled',
                'label'   => 'Scheduled?',
                'name'    => 'is_scheduled',
                'type'    => 'true_false',
                'ui'      => 1,
                'readonly' => 1,
                'wrapper' => [ 'width' => '33%' ]
            ],
            [
                'key'     => 'gf_flow_schedule_type',
                'label'   => 'Schedule Type',
                'name'    => 'schedule_type',
                'type'    => 'select',
                'choices' => [
                    ''          => 'None',
                    'delay'     => 'Delay',
                    'date'      => 'Specific Date',
                    'date_field' => 'Date Field'
                ],
                'readonly' => 1,
                'wrapper' => [ 'width' => '33%' ]
            ],
            [
                'key'     => 'gf_flow_schedule_value',
                'label'   => 'Schedule Value',
                'name'    => 'schedule_value',
                'type'    => 'text',
                'readonly' => 1,
                'wrapper' => [ 'width' => '34%' ]
            ],
            
            // Expiration
            [
                'key'     => 'gf_flow_has_expiration',
                'label'   => 'Has Expiration?',
                'name'    => 'has_expiration',
                'type'    => 'true_false',
                'ui'      => 1,
                'readonly' => 1,
                'wrapper' => [ 'width' => '50%' ]
            ],
            [
                'key'     => 'gf_flow_expiration_value',
                'label'   => 'Expiration (hours)',
                'name'    => 'expiration_value',
                'type'    => 'number',
                'readonly' => 1,
                'wrapper' => [ 'width' => '50%' ]
            ],
            
            // Step-Specific Settings (JSON)
            [
                'key'     => 'gf_flow_settings_json',
                'label'   => 'Step Settings (JSON)',
                'name'    => 'settings_json',
                'type'    => 'textarea',
                'rows'    => 8,
                'readonly' => 1,
                'instructions' => 'Complete step configuration in JSON format'
            ],
            
            // Conditional Logic
            [
                'key'     => 'gf_flow_has_conditional',
                'label'   => 'Has Conditional Logic?',
                'name'    => 'has_conditional_logic',
                'type'    => 'true_false',
                'ui'      => 1,
                'readonly' => 1,
                'wrapper' => [ 'width' => '50%' ]
            ],
            [
                'key'     => 'gf_flow_conditional_json',
                'label'   => 'Conditional Logic (JSON)',
                'name'    => 'conditional_logic_json',
                'type'    => 'textarea',
                'rows'    => 5,
                'readonly' => 1,
                'wrapper' => [ 'width' => '50%' ]
            ],
            
            // Outcomes and Actions
            [
                'key'     => 'gf_flow_outcomes',
                'label'   => 'Step Outcomes',
                'name'    => 'step_outcomes',
                'type'    => 'textarea',
                'rows'    => 3,
                'readonly' => 1,
                'instructions' => 'Possible outcomes (approve, reject, complete, etc.)'
            ],
            [
                'key'     => 'gf_flow_next_steps',
                'label'   => 'Next Steps',
                'name'    => 'next_steps',
                'type'    => 'textarea',
                'rows'    => 3,
                'readonly' => 1,
                'instructions' => 'What happens after this step completes'
            ],
        ],
        'position'     => 'acf_after_title',
        'show_in_rest' => true,
    ] );
} );

Comments

Add a Comment