You are here

function insight_admin_api_settings in Insight 7

Builds and returns the insight settings form.

1 string reference to 'insight_admin_api_settings'
insight_menu in ./insight.module
Implements hook.().

File

./insight.admin.inc, line 57
Admin page callback for the insight module.

Code

function insight_admin_api_settings() {
  $apikey = variable_get('insight_apikey', '');
  if (!$apikey) {
  }
  $form['insight_apikey'] = array(
    '#type' => 'textfield',
    '#title' => t('API key'),
    '#default_value' => variable_get('insight_apikey', ''),
    //'#description' => t('This is an example setting.'),
    '#required' => TRUE,
  );
  if ($apikey) {
    $perms = insight_api_query_permissions();
    $form['acctstatus_hdr'] = array(
      '#type' => 'markup',
      '#markup' => '<h3>' . t('Account Permissions') . '</h3>',
    );
    $statuses = array(
      'get_all_words_popularity' => t('Get all words popularity'),
      'get_embedded_phrase_popularity' => t('Get embedded phrase popularity'),
      'get_exact_phrase_popularity' => t('Get exact phrase popularity'),
      'get_plurals' => t('Get plurals'),
      'get_lateral_keyphrases' => t('Get lateral keyphrases'),
      'get_thesaurus_keyphrases' => t('Get thesaurus keyphrases'),
    );
    foreach ($statuses as $k => $v) {
      $enabled = 'N';
      if ($perms[$k]) {
        $limit = $perms[$k]['result_limit'];
        if ($limit > 0) {
          $enabled = 'Y (limit ' . $limit . ')';
        }
      }
      $form['wordtracker_' . $k] = array(
        '#type' => 'item',
        '#title' => $v,
        '#value' => "Enabled: " . $enabled,
      );
    }
  }
  return system_settings_form($form);
}