ActiveCampaign
Data
This filter is used if you want to change form fields data before output. This way you can change components map before it is parsed inside Block Editor.
For example if you want to set all fields to have 2 columns layout this will be the filter to use.
add_filter('es_forms_integrations_active_campaign_data', function(array $data, string $formId): array {
foreach ($data as $index => $field) {
$component = $field['component'] ?? '';
if (!$component) {
continue;
}
$name = $field["{$component}Name"] ?? '';
if (!$name) {
continue;
}
switch ($name) {
case 'firstname':
case 'lastname':
$data[$index]["{$component}FieldWidthMobile"] = 12;
$data[$index]["{$component}FieldWidthLarge"] = 6;
$data[$index]["{$component}DisabledOptions"] = array_merge(
$data[$index]["{$component}DisabledOptions"],
[
"{$component}FieldWidthMobile",
"{$component}FieldWidthLarge",
]
);
break;
}
}
return $data;
}, 10, 2);
Pre post params
Change form fields data before it is sent to the external integration. This way you can manuipulate data and provide additional mapping to the data sent to the integration.
add_filter('es_forms_integrations_active_campaign_pre_post_params', function(array $params): array {
$formSubmissionPageLt = $params['form_submission_page_lt']['value'] ?? '';
if ($formSubmissionPageLt) {
$params['ib-submission-source'] = [
'name' => 'ib-submission-source',
'value' => $formSubmissionPageLt,
'type' => 'text',
'internalType' => '',
];
}
return $params;
});