PluginProbe
Bit Form – Contact Form, Payment Forms, Multi Step Forms, Calculator & Custom Form Builder / 2.0
Bit Form – Contact Form, Payment Forms, Multi Step Forms, Calculator & Custom Form Builder v2.0
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.0, at includes/Core/Integration/Hubspot/Common.php

57 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 public static function formFldMapping($dataFinal, $fieldMap, $data, $type = '') {
7 foreach ($fieldMap as $value) {
8 $triggerValue = $value->formField;
9 $actionValue = $value->hubspotField;
10 if ('custom' === $triggerValue) {
11 $dataFinal[$actionValue] = $value->customValue;
12 } elseif (!is_null($data[$triggerValue])) {
13 if ('deal' === $type) {
14 if (strtotime($data[$triggerValue])) {
15 $formated = strtotime($data[$triggerValue]);
16 $dataFinal[$actionValue] = $formated;
17 } else {
18 $dataFinal[$actionValue] = $data[$triggerValue];
19 }
20 } else {
21 $dataFinal[$actionValue] = $data[$triggerValue];
22 }
23 }
24 }
25 return $dataFinal;
26 }
27
28 public static function customFldMapping($type, $action, $integrationDetails, $data) {
29 $customFields = self::customFields();
30 foreach ($customFields[$type] as $key => $name) {
31 if (property_exists($action, $name)) {
32 $data[$key] = $integrationDetails->{$name};
33 }
34 }
35 return $data;
36 }
37
38 public static function customFields() {
39 return [
40 'lead' => [
41 'hs_lead_status' => 'lead_status',
42 'lifecyclestage' => 'lifecycle_stage',
43 'hubspot_owner_id' => 'contact_owner',
44 ],
45 'deal' => [
46 'hubspot_owner_id' => 'contact_owner',
47 'deal_type' => 'dealtype',
48 'hs_priority' => 'priority',
49 ],
50 'company' => [
51 'associatedCompanyIds' => 'company',
52 'associatedVids' => 'contact',
53 ],
54 ];
55 }
56 }
57