Edit Form in WordPress admin * 2. Click "📋 Export Layout" button in toolbar * 3. Script copies formatted table to clipboard * 4. Opens new Google Docs tab automatically * 5. Paste (Ctrl+V) into Google Doc * * NOTES * - Detects form field widths (quarter, half, full, etc.) * - Resolves GPPA field mappings to human-readable labels * - Shows conditional logic rules with field references * - Exports hidden/admin-only field indicators * - Table format optimized for Google Docs */ add_action( 'wp_ajax_get_gppa_form_fields', function () { if ( ! current_user_can( 'gravityforms_edit_forms' ) ) { wp_send_json_error( 'Permission denied', 403 ); } $nonce = isset( $_POST['_ajax_nonce'] ) ? sanitize_text_field( wp_unslash( $_POST['_ajax_nonce'] ) ) : ''; if ( '' === $nonce || ! wp_verify_nonce( $nonce, 'get_gppa_form_fields' ) ) { wp_send_json_error( 'Invalid nonce', 400 ); } $form_id = isset( $_POST['form_id'] ) ? absint( $_POST['form_id'] ) : 0; if ( ! $form_id ) { wp_send_json_error( 'Missing form ID', 400 ); } if ( ! class_exists( 'GFAPI' ) ) { wp_send_json_error( 'Gravity Forms not available', 500 ); } try { $form = GFAPI::get_form( $form_id ); } catch ( Exception $e ) { wp_send_json_error( 'Error loading form', 500 ); } if ( ! $form || empty( $form['fields'] ) ) { wp_send_json_error( 'Form not found', 404 ); } $field_map = []; foreach ( $form['fields'] as $field ) { if ( isset( $field->id ) && isset( $field->label ) ) { $field_map[ $field->id ] = $field->label; } } wp_send_json_success( [ 'title' => rgar( $form, 'title' ), 'fields' => $field_map, ] ); } ); add_action( 'gform_editor_js', function () { $nonce = wp_create_nonce( 'get_gppa_form_fields' ); ?>