You are here

function ga_stats_auth_settings in Google Analytics Statistics 7.2

Same name and namespace in other branches
  1. 7 ga_stats.admin.inc \ga_stats_auth_settings()

Callback for GA Stats authentication form.

1 string reference to 'ga_stats_auth_settings'
ga_stats_menu in ./ga_stats.module
Implements hook_menu().

File

./ga_stats.admin.inc, line 6

Code

function ga_stats_auth_settings() {
  $form = array();
  $private_path = variable_get('file_private_path', FALSE);
  if (empty($private_path)) {
    drupal_set_message(t('Your need to set the private file system path. Visit the !filesystem to configure it.', array(
      '!filesystem' => l(t('File system config page'), 'admin/config/media/file-system'),
    )), 'error');
    $form['#disabled'] = TRUE;
  }
  $form['ga_stats_login'] = array(
    '#type' => 'fieldset',
    '#title' => t('Google Analytics Login Information'),
    '#collapsible' => TRUE,
    '#collapsed' => ga_stats_is_ready(),
  );
  $form['ga_stats_login']['ga_stats_app_name'] = array(
    '#type' => 'textfield',
    '#title' => t('App Name'),
    '#description' => t('The name of your app on google'),
    '#default_value' => variable_get('ga_stats_app_name', ''),
  );
  $form['ga_stats_login']['ga_stats_email'] = array(
    '#type' => 'textfield',
    '#title' => t('Google App Email'),
    '#description' => t('The email address which was provided when you created App API credentials'),
    '#default_value' => variable_get('ga_stats_email', ''),
  );
  $private_key_path = variable_get('ga_stats_private_key_p12');
  $form['ga_stats_login']['private_key'] = array(
    '#type' => 'file',
    '#title' => t('Private Key'),
    '#description' => empty($private_key_path) ? 'No file uploaded. Please upload. (Allowed extensions: p12)' : 'The key file is uploaded. Uploading another file will override the existing one. (Allowed extensions: p12)',
    '#upload_validators' => array(
      'file_validate_extensions' => array(
        'p12',
      ),
    ),
  );
  $form['#submit'][] = 'ga_stats_custom_form_submit';
  return system_settings_form($form);
}