PluginProbe
Bit Form – Contact Form, Payment Forms, Multi Step Forms, Calculator & Custom Form Builder / 2.9.1
Bit Form – Contact Form, Payment Forms, Multi Step Forms, Calculator & Custom Form Builder v2.9.1
V-3.3.0 3.2.2 3.2.1 3.2.0 3.1.4 3.1.3 3.1.2 3.1.1 3.1.0 V3.0.3 V3.0.2 -3.0.1 V_3.0.0 1.1.1 1.1.8 1.2 1.3 1.4 1.4.18 1.5.2 1.9 2.0 2.10.0 2.10.1 2.10.2 All 137 releases
bit-form / includes / Core / Integration / Hubspot / Common.php

Common.php in Bit Form – Contact Form, Payment Forms, Multi Step Forms, Calculator & Custom Form Builder 2.9.1, at includes/Core/Integration/Hubspot/Common.php

61 lines 1.6 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace BitCode\BitForm\Core\Integration\Hubspot;
4
5 class Common
6 {
7 public static function formFldMapping($dataFinal, $fieldMap, $data, $type = '')
8 {
9 foreach ($fieldMap as $value) {
10 $triggerValue = $value->formField;
11 $actionValue = $value->hubspotField;
12 if ('custom' === $triggerValue) {
13 $dataFinal[$actionValue] = $value->customValue;
14 } elseif (!is_null($data[$triggerValue])) {
15 if ('deal' === $type) {
16 if (strtotime($data[$triggerValue])) {
17 $formated = strtotime($data[$triggerValue]);
18 $dataFinal[$actionValue] = $formated;
19 } else {
20 $dataFinal[$actionValue] = $data[$triggerValue];
21 }
22 } else {
23 $dataFinal[$actionValue] = $data[$triggerValue];
24 }
25 }
26 }
27 return $dataFinal;
28 }
29
30 public static function customFldMapping($type, $action, $integrationDetails, $data)
31 {
32 $customFields = self::customFields();
33 foreach ($customFields[$type] as $key => $name) {
34 if (property_exists($action, $name)) {
35 $data[$key] = $integrationDetails->{$name};
36 }
37 }
38 return $data;
39 }
40
41 public static function customFields()
42 {
43 return [
44 'lead' => [
45 'hs_lead_status' => 'lead_status',
46 'lifecyclestage' => 'lifecycle_stage',
47 'hubspot_owner_id' => 'contact_owner',
48 ],
49 'deal' => [
50 'hubspot_owner_id' => 'contact_owner',
51 'deal_type' => 'dealtype',
52 'hs_priority' => 'priority',
53 ],
54 'company' => [
55 'associatedCompanyIds' => 'company',
56 'associatedVids' => 'contact',
57 ],
58 ];
59 }
60 }
61