function shurly_api_key_form in ShURLy 7
Same name and namespace in other branches
- 8 shurly_service/shurly_service.module \shurly_api_key_form()
- 6 shurly_service/shurly_service.module \shurly_api_key_form()
Form callback; Display a form with a textfield containing a user's API key.
1 string reference to 'shurly_api_key_form'
- shurly_service_block_view in shurly_service/
shurly_service.module - Implements hook_block_view().
File
- shurly_service/
shurly_service.module, line 91 - Link ShURLy functionalities to services module. @todo
Code
function shurly_api_key_form($form, &$form_state) {
global $user;
module_load_include('inc', 'shurly_service', 'shurly_api_keys');
$key = shurly_get_api_key($user->uid);
$form = array();
if ($key) {
$form['key'] = array(
'#type' => 'textfield',
'#title' => t('API key'),
'#default_value' => $key,
'#description' => t('You can provide this key to 3rd party apps rather than sharing your password.'),
);
$form['reset'] = array(
'#type' => 'submit',
'#value' => t('Reset'),
'#suffix' => t('If a 3rd party is misusing your API key, you can generate a new one.'),
);
}
else {
$form['new'] = array(
'#type' => 'submit',
'#value' => t('Create'),
'#suffix' => t('Create an API key to use with 3rd party applications.'),
);
}
return $form;
}