Skip to content

Commit 511f919

Browse files
authored
fix: checkboxes crashing when empty (#88)
1 parent 205ee60 commit 511f919

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

source/php/Submission.php

+6-1
Original file line numberDiff line numberDiff line change
@@ -138,9 +138,14 @@ public function submit()
138138

139139

140140
foreach ($fields as $key => $field) {
141-
if ($field['acf_fc_layout'] == 'checkbox' && is_array($field['values'])) {
141+
if (
142+
$field['acf_fc_layout'] == 'checkbox' &&
143+
is_array($field['values']) &&
144+
!empty($_POST[sanitize_title($field['label'])])
145+
) {
142146
$_POST['ange-vilka-handlingar-du-vill-bestalla'] = implode(",", $_POST[sanitize_title($field['label'])]);
143147
}
148+
144149
if ($field['acf_fc_layout'] == 'sender') {
145150
if (!empty($field['custom_sender_labels']['add_sender_labels'])) {
146151
$labels = array_merge($labels, array_filter($field['custom_sender_labels']));

0 commit comments

Comments
 (0)