Skip to content

Commit

Permalink
updating moments docs
Browse files Browse the repository at this point in the history
  • Loading branch information
iruzevic committed Feb 12, 2024
1 parent 081e361 commit 4d7cc69
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 4d7cc69

Please sign in to comment.