You are here

function _hubspot_default_value in HubSpot 3.x

Same name and namespace in other branches
  1. 8 hubspot.module \_hubspot_default_value()

Returns the default value for the given arguments.

File

./hubspot.module, line 53
Sends Webform results to HubSpot's Forms API.

Code

function _hubspot_default_value($id, $hubspot_guid = NULL, $webform_field = NULL) {
  $query = \Drupal::database()
    ->select('hubspot', 'h');
  $query
    ->addField('h', 'hubspot_guid');
  $query
    ->condition('h.id', $id);
  if ($hubspot_guid && $webform_field) {
    $query
      ->condition('h.hubspot_guid', $hubspot_guid);
    $query
      ->condition('h.webform_field', $webform_field);
  }
  $query
    ->range(0, 1);
  return $query
    ->execute()
    ->fetchField();
}