Calculator
Pre-post parameters filter
Allows modifying form field data before it's sent to calculator. Useful if you want to make values derived from the sent data, or add new fields.
add_filter('es_forms_integrations_calculator_pre_post_params', 'getIntegrationPrePostParams', 10, 2);
/**
* Modifies form field data before it's sent to calculator.
*
* @param array<string, mixed> $params Array of params.
* @param string $formId Form ID.
*
* @return array<string, mixed>
*/
function getIntegrationPrePostParams(array $params, string $formId): 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;
}