You are here

function twitter_account_form in Twitter 7.3

Same name and namespace in other branches
  1. 6.3 twitter.pages.inc \twitter_account_form()
  2. 6.4 twitter.pages.inc \twitter_account_form()
  3. 7.4 twitter.pages.inc \twitter_account_form()

Form to add a Twitter account

If OAuth is not enabled, a text field lets users to add their Twitter screen name. If it is, a submit button redirects to Twitter.com asking for authorisation.

1 string reference to 'twitter_account_form'
twitter_user_settings in ./twitter.pages.inc
@todo Please document this function.

File

./twitter.pages.inc, line 297
Page callbacks for Twitter module.

Code

function twitter_account_form($form, $form_state, $account = NULL) {
  if (empty($account)) {
    global $user;
    $account = $user;
  }
  $form['uid'] = array(
    '#type' => 'value',
    '#value' => $account->uid,
  );
  if (_twitter_use_oauth()) {
    $form['#validate'] = array(
      'twitter_account_oauth_validate',
    );
  }
  else {
    $form['screen_name'] = array(
      '#type' => 'textfield',
      '#required' => TRUE,
      '#title' => t('Twitter user name'),
    );
    $form['import'] = array(
      '#type' => 'checkbox',
      '#title' => t('Import statuses from this account'),
      '#default_value' => TRUE,
      '#access' => FALSE,
    );
  }
  $form['submit'] = array(
    '#type' => 'submit',
    '#value' => t('Add account'),
  );
  return $form;
}