Skip to content

Commit

Permalink
Combine group fields into the pods_register_group() call
Browse files Browse the repository at this point in the history
  • Loading branch information
sc0ttkclark committed Jul 21, 2022
1 parent 74a6986 commit 8461551
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions admin/classes/pods-export-code-api.php
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,7 @@ public function export_pod( $pod_name ) {
}
}

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

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

$output .= sprintf( "\t\$group_field = %s;\n\n", $this->var_export_format( $group_field, 1 ) );
$output .= "\tpods_register_group_field( \$group_field, \$group['name'], \$pod['name'] );\n\n";
$group_fields_to_export[ $group_field['name'] ] = $group_field;
}

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

return $output;
Expand Down

0 comments on commit 8461551

Please sign in to comment.