function wordstream_admin_settings in WordStream Keyword Tools 6
Same name and namespace in other branches
- 7 wordstream.admin.inc \wordstream_admin_settings()
Displays the form for the standard settings tab.
Return value
array A structured array for use with Forms API.
1 string reference to 'wordstream_admin_settings'
- wordstream_menu in ./
wordstream.module - Implementation of hook_menu().
File
- ./
wordstream.admin.inc, line 14 - Admin include file.
Code
function wordstream_admin_settings() {
$wordstream = wordstream_include_api_class();
if (!$wordstream) {
return '';
}
$ret = $wordstream
->getAPICredits();
$account = 1;
if (!$ret->credits_per_month) {
drupal_set_message(t('You are unable to log in to WordStream. Please enter a valid WordStream API username and password.'), 'error');
$account = 0;
}
//dsm($ret);
$form['wordstream_username'] = array(
'#type' => 'textfield',
'#title' => t('WordStream API username'),
'#description' => t(''),
'#default_value' => variable_get('wordstream_username', ''),
'#description' => t('In order to enable the API tools you will need a WordStream account login (username & password). !wordstream_link.', array(
'!wordstream_link' => l(t('Get your API account here'), WORDSTREAM_LINK_API_ACCOUNT, array(
'attributes' => array(
'target',
'wordstream',
),
)),
)),
);
$form['wordstream_password'] = array(
'#type' => 'password',
'#title' => t('WordStream API password'),
'#description' => t(''),
'#default_value' => variable_get('wordstream_password', ''),
);
$form['wordstream_cache_time'] = array(
'#type' => 'textfield',
'#title' => t('Cache time'),
'#description' => t('API results are cached. Use this value to set in seconds the time before checking if the cache data is out of date.'),
'#default_value' => variable_get('wordstream_cache_time', 604800),
);
if ($account) {
$form['wordstream_account_status'] = array(
'#type' => 'markup',
'#value' => '<h3>' . t('Account Status') . '</h3>',
);
$form['wordstream_remaining_monthly_credits'] = array(
'#type' => 'item',
'#title' => t('Remaining montly credits'),
'#value' => $ret->remaining_monthly_credits,
);
$form['wordstream_credits_per_month'] = array(
'#type' => 'item',
'#title' => t('Credits per month'),
'#value' => $ret->credits_per_month,
);
}
$form['wordstream_stats_report_options'] = array(
'#type' => 'fieldset',
'#title' => t('Stats report options'),
'#collapsible' => TRUE,
'#collapsed' => FALSE,
);
$form['wordstream_stats_report_options'] = array_merge($form['wordstream_stats_report_options'], wordstream_stats_report_form_options());
return system_settings_form($form);
}