Skip to content

Commit

Permalink
fix: checkboxes crashing when empty (#88)
Browse files Browse the repository at this point in the history
  • Loading branch information
NiclasNorin authored Mar 31, 2024
1 parent 205ee60 commit 511f919
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion source/php/Submission.php
Original file line number Diff line number Diff line change
Expand Up @@ -138,9 +138,14 @@ public function submit()


foreach ($fields as $key => $field) {
if ($field['acf_fc_layout'] == 'checkbox' && is_array($field['values'])) {
if (
$field['acf_fc_layout'] == 'checkbox' &&
is_array($field['values']) &&
!empty($_POST[sanitize_title($field['label'])])
) {
$_POST['ange-vilka-handlingar-du-vill-bestalla'] = implode(",", $_POST[sanitize_title($field['label'])]);
}

if ($field['acf_fc_layout'] == 'sender') {
if (!empty($field['custom_sender_labels']['add_sender_labels'])) {
$labels = array_merge($labels, array_filter($field['custom_sender_labels']));
Expand Down

0 comments on commit 511f919

Please sign in to comment.