Skip to content

Commit 8461551

Browse files
committed
Combine group fields into the pods_register_group() call
1 parent 74a6986 commit 8461551

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

admin/classes/pods-export-code-api.php

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -88,8 +88,7 @@ public function export_pod( $pod_name ) {
8888
}
8989
}
9090

91-
$output .= sprintf( "\t\$group = %s;\n\n", $this->var_export_format( $group, 1 ) );
92-
$output .= "\tpods_register_group( \$group, \$pod['name'] );\n\n";
91+
$group_fields_to_export = [];
9392

9493
// Output a pods_register_field() call for each field
9594
foreach ( $group_fields as $group_field ) {
@@ -105,9 +104,12 @@ public function export_pod( $pod_name ) {
105104
}
106105
}
107106

108-
$output .= sprintf( "\t\$group_field = %s;\n\n", $this->var_export_format( $group_field, 1 ) );
109-
$output .= "\tpods_register_group_field( \$group_field, \$group['name'], \$pod['name'] );\n\n";
107+
$group_fields_to_export[ $group_field['name'] ] = $group_field;
110108
}
109+
110+
$output .= sprintf( "\t\$group = %s;\n\n", $this->var_export_format( $group, 1 ) );
111+
$output .= sprintf( "\t\$group_fields = %s;\n\n", $this->var_export_format( $group_fields_to_export, 1 ) );
112+
$output .= "\tpods_register_group( \$group, \$pod['name'], \$group_fields );\n\n";
111113
}
112114

113115
return $output;

0 commit comments

Comments
 (0)