function tweet_feed_account_form in Tweet Feed 7.2
Same name and namespace in other branches
- 7.3 tweet_feed_admin.inc \tweet_feed_account_form()
Settings form our settings for for oauth tokens and search queries
1 string reference to 'tweet_feed_account_form'
- tweet_feed_menu in ./
tweet_feed.module - Implements hook_menu().
File
- ./
tweet_feed_admin.inc, line 142
Code
function tweet_feed_account_form($form, &$form_state, $aid = 0) {
// Set up the right breadcrumbs
$breadcrumbs = array();
$breadcrumbs[] = l('Home', '<front>');
$breadcrumbs[] = l('Administration', 'admin');
$breadcrumbs[] = l('Configuration', 'admin/config');
$breadcrumbs[] = l('Web Services', 'admin/config/services');
$breadcrumbs[] = l('Tweet Feed Accounts', 'admin/config/services/tweet_feed/accounts');
$breadcrumbs[] = l('Tweet Feed Account Form', substr(request_uri(), 1));
drupal_set_breadcrumb($breadcrumbs);
// If we are being passed an aid, then we are updating the form and need to repopulate
// the values and tell the processor that we are updating and not creating new.
if (!empty($aid)) {
$result = db_select('tweet_accounts', 'a')
->fields('a')
->condition('a.aid', $aid)
->execute()
->fetchObject();
$account_name = $result->account_name;
$consumer_key = $result->consumer_key;
$consumer_secret = $result->consumer_secret;
$oauth_token = $result->oauth_token;
$oauth_token_secret = $result->oauth_token_secret;
}
else {
// Otherwise just initialize the form so we do not have a swath of errors
$aid = $account_name = $consumer_key = $consumer_secret = NULL;
$oauth_token = $oauth_token_secret = NULL;
}
// Set up our settings form for this particular account (new or update)
if (!empty($aid)) {
$form['aid'] = array(
'#type' => 'hidden',
'#value' => $aid,
);
}
$form['tweet_feed_account'] = array(
'#type' => 'fieldset',
'#title' => t('Tweet Feed Account Information Form'),
'#description' => t('Provide information about the Twitter account you wish to add. These can be used to get the feeds for any of our configurable options.'),
);
$form['tweet_feed_account']['account_name'] = array(
'#type' => 'textfield',
'#title' => t('Account Name'),
'#max_length' => 128,
'#required' => TRUE,
'#default_value' => $account_name,
);
$form['tweet_feed_account']['consumer_key'] = array(
'#type' => 'textfield',
'#title' => t('Consumer Key'),
'#max_length' => 255,
'#required' => TRUE,
'#default_value' => $consumer_key,
);
$form['tweet_feed_account']['consumer_secret'] = array(
'#type' => 'textfield',
'#title' => t('Consumer Secret'),
'#max_length' => 255,
'#required' => TRUE,
'#default_value' => $consumer_secret,
);
$form['tweet_feed_account']['oauth_token'] = array(
'#type' => 'textfield',
'#title' => t('Oauth Token'),
'#max_length' => 255,
'#required' => TRUE,
'#default_value' => $oauth_token,
);
$form['tweet_feed_account']['oauth_token_secret'] = array(
'#type' => 'textfield',
'#title' => t('Oauth Token Secret'),
'#max_length' => 255,
'#required' => TRUE,
'#default_value' => $oauth_token_secret,
);
$form['submit'] = array(
'#type' => 'submit',
'#value' => t('Save Form'),
);
return $form;
}