Skip to content

Commit

Permalink
Merge pull request #300 from infinum/form/moments
Browse files Browse the repository at this point in the history
updating moments docs
  • Loading branch information
iruzevic authored Feb 12, 2024
2 parents 4e69c16 + 4d7cc69 commit 10fe256
Showing 1 changed file with 59 additions and 0 deletions.
59 changes: 59 additions & 0 deletions website/forms/php/filters/integrations/moments.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,62 @@ title: Moments
import { IntegrationFilters } from './../../../../src/docs/filters';

<IntegrationFilters name="Moments" filter="moments" />

## 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<string, mixed> $params Form fields params.
* @param string $eventName Event name value.
* @param array<string, mixed> $map Map value.
* @param string $formId FormId value.
*
* @return array<mixed>
*/
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<string, mixed> $output Output data.
* @param array<string, mixed> $params Params original list.
* @param string $eventName Event name value.
* @param string $formId FormId value.
*
* @return array<mixed>
*/
public function getMomentsPrePostEventParamsAfter(array $output, array $params, string $eventName, string $formId): array
{
$output['properties']["testKey"] = 'testValue';

return $output;
}
```

0 comments on commit 10fe256

Please sign in to comment.