Alert: This function’s access is marked private. This means it is not intended for use by plugin or theme developers, only in other core functions. It is listed here for completeness.
MP_Addon_Infusionsoft::prepare_lead_data( array $lead_data )
Prepare lead data to JSON.
Contents
Parameters Parameters
- $lead_data
-
(array) (Required) lead data
Return Return
(false|string) Lead data in JSON { Lead data. @type string 'firstname' lead first name @type string 'secondname' lead second name @type string 'email' lead email @type string 'phone' lead phone }
Source Source
File: calculator-infusionsoft-add-on/inc/MP_Addon_Infusionsoft.php
private function prepare_lead_data( $lead_data ) {
$data = array(
"given_name" => isset( $lead_data['firstname'] ) ? sanitize_text_field( $lead_data['firstname'] ) : "",
"family_name" => isset( $lead_data['secondname'] ) ? sanitize_text_field( $lead_data['secondname'] ) : "",
"duplicate_option" => get_option( MortgagePlatform::$prefix . 'infusionsoft' )['infusionsoft_duplicate_option'] ?? 'Email',
"email_addresses" => array(
array(
"email" => isset( $lead_data['email'] ) ? sanitize_text_field( $lead_data['email'] ) : "",
"field" => "EMAIL1"
)
),
"phone_numbers" => array(
array(
"field" => "PHONE1",
"number" => isset( $lead_data['phone'] ) ? sanitize_text_field( $lead_data['phone'] ) : "",
)
),
);
/**
* Action infusionsoft data.
* @since 1.0.0
*
* @param array $data {
* Lead data.
*
* @type string 'firstname' lead first name
* @type string 'secondname' lead second name
* @type string 'email' lead email
* @type string 'phone' lead phone
* }
*/
do_action( 'infusionsoft_data', $data );
return $data;
}
Changelog Changelog
| Version | Description |
|---|---|
| 1.0.0 | Introduced. |