You are here

function hubspot_admin_settings in HubSpot 7.2

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

Form constructor for the Hubspot admin settings form.

See also

hubspot_admin_settings_validate()

hubspot_admin_settings_submit()

2 string references to 'hubspot_admin_settings'
hubspot_menu in ./hubspot.module
Implements hook_menu().
hubspot_webform_form_alter in hubspot_webform/hubspot_webform.module
Implements hook_form_alter().

File

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

Code

function hubspot_admin_settings() {
  $form = array();
  $form['additional_settings'] = array(
    '#type' => 'vertical_tabs',
  );
  $form['settings'] = array(
    '#title' => t('Connectivity'),
    '#type' => 'fieldset',
    '#collapsible' => TRUE,
    '#group' => 'additional_settings',
  );
  $form['settings']['hubspot_portalid'] = array(
    '#title' => t('HubSpot Portal ID'),
    '#type' => 'textfield',
    '#required' => TRUE,
    '#default_value' => variable_get('hubspot_portalid', ''),
    '#description' => t('Enter the Hubspot Portal ID for this site.  It can be found by
      <a href="https://login.hubspot.com/login" target="_blank">logging into HubSpot</a> going to the Dashboard and
      examining the url. Example: "https://app.hubspot.com/dashboard-plus/12345/dash/".  The number after
      "dashboard-plus" is your Portal ID.'),
  );
  if (variable_get('hubspot_portalid', '')) {
    $form['settings']['hubspot_authentication'] = array(
      '#value' => t('Connect Hubspot Account'),
      '#type' => 'submit',
      '#validate' => array(),
      '#submit' => array(
        'hubspot_oauth_submit',
      ),
    );
    if (variable_get('hubspot_refresh_token', '')) {
      $form['settings']['hubspot_authentication']['#suffix'] = t('Your Hubspot account is connected.');
      $form['settings']['hubspot_authentication']['#value'] = t('Disconnect Hubspot Account');
      $form['settings']['hubspot_authentication']['#submit'] = array(
        'hubspot_oauth_disconnect',
      );
    }
  }
  $form['settings']['hubspot_log_code'] = array(
    '#title' => t('HubSpot Traffic Logging Code'),
    '#type' => 'textarea',
    '#default_value' => variable_get('hubspot_log_code', ''),
    '#description' => t('To enable HubSpot traffic logging on your site, paste the External Site Traffic Logging code
      here.'),
  );
  $form['debug'] = array(
    '#title' => t('Debugging'),
    '#type' => 'fieldset',
    '#collapsible' => TRUE,
    '#group' => 'additional_settings',
  );
  $form['debug']['hubspot_debug_on'] = array(
    '#title' => t('Debugging enabled'),
    '#type' => 'checkbox',
    '#default_value' => variable_get('hubspot_debug_on', 0),
    '#description' => t('If debugging is enabled, HubSpot errors will be emailed to the address below. Otherwise, they
      will be logged to the regular Drupal error log.'),
  );
  $form['debug']['hubspot_debug_email'] = array(
    '#title' => t('Debugging email'),
    '#type' => 'textfield',
    '#default_value' => variable_get('hubspot_debug_email', variable_get('site_mail', '')),
    '#description' => t('Email error reports to this address if debugging is enabled.'),
  );
  $form['submit'] = array(
    '#type' => 'submit',
    '#value' => 'Save Configuration',
  );
  return $form;
}