Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletion classes/PodsAPI.php
Original file line number Diff line number Diff line change
Expand Up @@ -1810,6 +1810,12 @@ public function save_pod( $params, $sanitized = false, $db = true ) {

$params->overwrite = ! empty( $params->overwrite ) ? (bool) $params->overwrite : false;

// Skip auto-created default groups (used when duplicating a Pod so the
// loop below recreates the original groups fully).
$bypass_default_groups = ! empty( $params->bypass_default_groups );

unset( $params->bypass_default_groups );

$order_group_fields = null;

if ( isset( $params->order ) ) {
Expand Down Expand Up @@ -2108,7 +2114,7 @@ public function save_pod( $params, $sanitized = false, $db = true ) {

$save_groups_for_pod = false;

if ( empty( $pod['groups'] ) || ! is_array( $pod['groups'] ) ) {
if ( ! $bypass_default_groups && ( empty( $pod['groups'] ) || ! is_array( $pod['groups'] ) ) ) {
$default_group_label = __( 'More Fields', 'pods' );
$default_group_fields = [];

Expand Down Expand Up @@ -6615,6 +6621,11 @@ public function duplicate_pod( $params, $strict = false ) {

unset( $pod['id'], $pod['parent'], $pod['object_type'], $pod['object_storage_type'], $pod['groups'] );

// Don't auto-create the default "Details" group for ACT pods here, as
// the original groups are recreated in the loop below. Auto-creating it
// would collide with an original group named "details" and drop its fields.
$pod['bypass_default_groups'] = true;

try {
$pod_id = $this->save_pod( $pod );
} catch ( Exception $exception ) {
Expand Down