-
Notifications
You must be signed in to change notification settings - Fork 0
/
insightly_webform.api.php
44 lines (40 loc) · 1.39 KB
/
insightly_webform.api.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
<?php
/**
* @file
* Sample hooks demonstrating usage in Salesforce Web-to-Lead Webform Data Integration.
*/
/**
* @defgroup webform_hooks Webform Module Hooks
* @{
* insightly_webform's hooks enable other modules to intercept events, such
* as the completion of a submission and its subsequent passing of post strings to salesforce.
*/
/**
* Alter the processed array of posted fields data coming from webform and about to be passed to salesforce
* @param array $data
* The posted data array about to be passed to salesforce
* @param array $context
* $context['webform_submission'] is a webform submission object containing
* webform nid, uid of the person submitting the form
* submission (Object) stdClass
* nid (String, 1 characters ) 1
* uid (String, 1 characters ) 1
* submitted (Integer) 1339531638
* remote_addr (String, 9 characters ) 127.0.0.1
* is_draft (Integer) 0
* data (Array, 1 element)
* sid (String, 1 characters ) 1
*/
function hook_insightly_webform_posted_data_alter(&$data, $context) {
// if the webform is node 1, then we are to do the following things to the posted data array
// before it gets posted
if ( $context['webform_submission']->nid == 1 ) {
// consider the webform field name as the company field too!
if ( !empty($data['name']) ) {
$data['company'] = $data['name'];
}
}
}
/**
* @}
*/