You are here

function _hubspot_webform_default_value in HubSpot 7.2

Same name and namespace in other branches
  1. 7.3 hubspot_webform/hubspot_webform.admin.inc \_hubspot_webform_default_value()

Returns the default value for the given arguments.

2 calls to _hubspot_webform_default_value()
hubspot_webform_form_settings in hubspot_webform/hubspot_webform.admin.inc
Form constructor for the Hubspot settings form.
_hubspot_webform_admin_settings in hubspot_webform/hubspot_webform.admin.inc
Hubspot webform admin settings.

File

hubspot_webform/hubspot_webform.admin.inc, line 274
Provides admin settings page to adjust form submission settings.

Code

function _hubspot_webform_default_value($nid, $hubspot_guid = NULL, $webform_field = NULL) {
  if (empty($hubspot_guid)) {
    return db_query_range("SELECT hubspot_guid FROM {hubspot} h WHERE h.nid = :nid", 0, 1, array(
      ':nid' => $nid,
    ))
      ->fetchField();
  }
  else {
    return db_query_range("SELECT hubspot_field FROM {hubspot} h WHERE h.nid = :nid AND h.hubspot_guid = :guid AND h.webform_field = :webform_field", 0, 1, array(
      ':nid' => $nid,
      ':guid' => $hubspot_guid,
      ':webform_field' => $webform_field,
    ))
      ->fetchField();
  }
}