id, $field->label ) ) { $field_map[ (string) $field->id ] = $field->label; } // Sub-fields (address parts, name parts, etc.) if ( isset( $field->inputs ) && is_array( $field->inputs ) ) { foreach ( $field->inputs as $input ) { if ( ! empty( $input['id'] ) ) { $sub_label = ! empty( $input['label'] ) ? ( $field->label . ' — ' . $input['label'] ) : $field->label; $field_map[ (string) $input['id'] ] = $sub_label; } } } } wp_send_json_success( [ 'title' => rgar( $form, 'title' ), 'fields' => $field_map, ] ); } ); // ───────────────────────────────────────────── // Inject the Export Layout button + script into the GF editor // ───────────────────────────────────────────── add_action( 'gform_editor_js', function () { $nonce = wp_create_nonce( 'gf_export_nonce' ); ?>