SilverStripe\Intercom\IntercomFormExtension
Adds functionality to forms to integrate with Intercom
- Author: Aaron Carlino <aaron@silverstripe.com>
Synopsis
class IntercomFormExtension
extends DataExtension
{
- // members
- protected array $intercomUserFieldMapping = ;
- protected array $intercomCompanyFieldMapping = ;
- protected array $intercomNoteMapping = ;
- protected string $intercomNoteHeader = '';
- // methods
- public Form addIntercomUserFieldMapping()
- public Form removeIntercomUserFieldMapping()
- public Form addIntercomCompanyFieldMapping()
- public Form removeIntercomCompanyFieldMapping()
- public Form addIntercomNoteMapping()
- public Form removeIntercomNoteFieldMapping()
- public Form setIntercomNoteHeader()
- protected array addMappings()
- public void sendToIntercom()
Hierarchy
Extends
- SilverStripe\ORM\DataExtension
Members
protected
- $intercomCompanyFieldMapping
—
array
A map of form field names to Intercom company fields [ 'Company' => 'name' ] - $intercomNoteHeader
—
string
The heading for the note, e.g. "This lead was submitted on date('d-m-y')" - $intercomNoteMapping
—
array
A list of form field names that should be thrown into Intercom notes for the user, mapped to the labels that should be used in the note [ 'FavouriteColor' => "The user's favourite color" ] - $intercomUserFieldMapping
—
array
A map of form field names to Intercom lead fields.
Methods
protected
- addMappings() — Adds FormFieldName => IntercomName mappings to a given array.
public
- addIntercomCompanyFieldMapping() — Adds mapping of form fields to intercom company fields
- addIntercomNoteMapping() — Adds mapping of note fields
- addIntercomUserFieldMapping() — Adds mapping of form fields to intercom user fields
- removeIntercomCompanyFieldMapping() — Removes a form field to Intercom company field mapping
- removeIntercomNoteFieldMapping() — Removes a form field to Intercom company field mapping
- removeIntercomUserFieldMapping() — Removes a form field to Intercom user field mapping
- sendToIntercom() — Sends the form data to Intercom, using the defined mappings
- setIntercomNoteHeader() — Sets the note header