From 241345893a16419b2b36403455f7f9c428434d8d Mon Sep 17 00:00:00 2001 From: Niclas Date: Fri, 17 Jan 2025 14:41:21 +0100 Subject: [PATCH] fix: corrected private acf fields accordion --- library/Admin/Private/PrivateAcfFields.php | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/library/Admin/Private/PrivateAcfFields.php b/library/Admin/Private/PrivateAcfFields.php index fc0fc0c3c..6b665477e 100644 --- a/library/Admin/Private/PrivateAcfFields.php +++ b/library/Admin/Private/PrivateAcfFields.php @@ -50,14 +50,19 @@ public function conditionallyShowBasedOnStatus($field) $field['conditional_logic'] = []; } - $field['conditional_logic'][] = - [ - [ - 'field' => $this->hiddenInputKey, - 'operator' => '==', - 'value' => 'private' - ] - ]; + $conditional = [ + 'field' => $this->hiddenInputKey, + 'operator' => '==', + 'value' => 'private' + ]; + + if (!empty($field['conditional_logic'])) { + foreach ($field['conditional_logic'] as &$logicGroup) { + $logicGroup[] = $conditional; + } + } else { + $field['conditional_logic'][] = [$conditional]; + } return $field; }