twitter_account_form

  1. drupal
    1. 6 twitter.pages.inc function
    2. 7 twitter.pages.inc function
Drupal 7 twitter_account_form($form, $form_state, $account = NULL)

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'

File

sites/all/modules/twitter/twitter.pages.inc, line 293

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;
}