You are here

protected function HubspotWebformHandler::getPostData in HubSpot 8

Same name and namespace in other branches
  1. 3.x src/Plugin/WebformHandler/HubspotWebformHandler.php \Drupal\hubspot\Plugin\WebformHandler\HubspotWebformHandler::getPostData()

Get a webform submission's post data.

Parameters

string $operation: The type of webform submission operation to be posted. Can be 'insert', 'update', or 'delete'.

\Drupal\webform\WebformSubmissionInterface $webform_submission: The webform submission to be posted.

Return value

array A webform submission converted to an associative array.

1 call to HubspotWebformHandler::getPostData()
HubspotWebformHandler::remotePost in src/Plugin/WebformHandler/HubspotWebformHandler.php
Execute a remote post.

File

src/Plugin/WebformHandler/HubspotWebformHandler.php, line 427

Class

HubspotWebformHandler
Webform submission remote post handler.

Namespace

Drupal\hubspot\Plugin\WebformHandler

Code

protected function getPostData($operation, WebformSubmissionInterface $webform_submission) {

  // Get submission and elements data.
  $data = $webform_submission
    ->toArray(TRUE);

  // Flatten data.
  // Prioritizing elements before the submissions fields.
  $data = $data['data'] + $data;
  unset($data['data']);
  return $data;
}