From 4d7cc69e15d6842b04b11408960180d8955acda7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ivan=20Ruz=CC=8Cevic=CC=81?= Date: Mon, 12 Feb 2024 11:47:24 +0100 Subject: [PATCH] updating moments docs --- .../php/filters/integrations/moments.mdx | 59 +++++++++++++++++++ 1 file changed, 59 insertions(+) diff --git a/website/forms/php/filters/integrations/moments.mdx b/website/forms/php/filters/integrations/moments.mdx index 416316d88..f3ce5d70f 100644 --- a/website/forms/php/filters/integrations/moments.mdx +++ b/website/forms/php/filters/integrations/moments.mdx @@ -6,3 +6,62 @@ title: Moments import { IntegrationFilters } from './../../../../src/docs/filters'; + +## Pre-Post Event Params + +This filter will allow you to add additional params to the body of the Moments integration payload before forms is done preparing the form params. + +```php +\add_filter('es_forms_integrations_moments_pre_post_event_params', 'getMomentsPrePostEventParams', 10, 4); + +/** + * Moments pre post event params before process. + * + * This filter will allow you to add additional params to the body of the Moments integration payload before forms is done preparing the form params. + * + * @param array $params Form fields params. + * @param string $eventName Event name value. + * @param array $map Map value. + * @param string $formId FormId value. + * + * @return array + */ +public function getMomentsPrePostEventParams(array $params, string $eventName, array $map, string $formId): array +{ + $params['ib-submission-source'] = [ + 'name' => 'ib-submission-source', + 'value' => 'value', + 'type' => 'text', + 'internalType' => '', + ]; + + return $params; +} +``` + +## Pre-Post Event Params After + +This filter will allow you to add additional params to the body of the Moments integration payload after forms is done preparing the form params. + +```php +\add_filter('es_forms_integrations_moments_pre_post_event_params_after', 'getMomentsPrePostEventParamsAfter', 10, 4); + +/** + * Moments pre post event params after process. + * + * This filter will allow you to add additional params to the body of the Moments integration payload after forms is done preparing the form params. + * + * @param array $output Output data. + * @param array $params Params original list. + * @param string $eventName Event name value. + * @param string $formId FormId value. + * + * @return array + */ +public function getMomentsPrePostEventParamsAfter(array $output, array $params, string $eventName, string $formId): array +{ + $output['properties']["testKey"] = 'testValue'; + + return $output; +} +```