From f240db244418d3c7a6a8c4b07e19b6d28b950a57 Mon Sep 17 00:00:00 2001 From: Will Dawber Date: Mon, 6 Jul 2020 16:22:14 +1200 Subject: [PATCH] Adding ability to post through multi select options --- code/extensions/EditableCampaignMonitorField.php | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/code/extensions/EditableCampaignMonitorField.php b/code/extensions/EditableCampaignMonitorField.php index 58e2820..6c677e3 100644 --- a/code/extensions/EditableCampaignMonitorField.php +++ b/code/extensions/EditableCampaignMonitorField.php @@ -246,7 +246,17 @@ public function getCustomFields(Array $data) // loop through the submitted data and check for custom fields foreach($data as $key=>$value){ if(count(explode('customfield_',$key)) > 1){ - $custom_fields[] = array("Key" => substr($key, 12), "Value" => $value); + if(is_array($value)){ + $newValue = ''; + $i=1; + foreach($value as $k => $v){ + $newValue .= $i == 1 ? $v : '||' . $v; + $i++; + } + $custom_fields[] = array("Key" => substr($key, 12), "Value" => $newValue); + } else { + $custom_fields[] = array("Key" => substr($key, 12), "Value" => $value); + } } }