You are here

function hubspot_admin_settings_validate in HubSpot 6.2

Same name and namespace in other branches
  1. 6 hubspot.admin.inc \hubspot_admin_settings_validate()
  2. 7.3 hubspot.admin.inc \hubspot_admin_settings_validate()
  3. 7 hubspot.admin.inc \hubspot_admin_settings_validate()
  4. 7.2 hubspot.admin.inc \hubspot_admin_settings_validate()

Validation for hubspot_admin_settings form. Ensure that the Portal ID has been entered and the debug email address provided is valid if debugging is enabled.

File

./hubspot.admin.inc, line 87
Provides admin settings page to adjust HubSpot API key, debugging settings, and JavaScript embedding.

Code

function hubspot_admin_settings_validate($form, &$form_state) {
  if (empty($form_state['values']['hubspot_portalid'])) {
    form_set_error('hubspot_portalid', t('You must provide a Hubspot Portal ID.'));
  }
  if ($form_state['values']['hubspot_debug_on'] && !valid_email_address($form_state['values']['hubspot_debug_email'])) {
    form_set_error('hubspot_debug_email', t('You must provide a valid email address.'));
  }
}