You are here

function twitter_admin_form in Twitter 6.4

Same name and namespace in other branches
  1. 6.5 twitter.pages.inc \twitter_admin_form()
  2. 6.2 twitter.pages.inc \twitter_admin_form()
  3. 6.3 twitter.pages.inc \twitter_admin_form()
  4. 7.6 twitter.pages.inc \twitter_admin_form()
  5. 7.3 twitter.pages.inc \twitter_admin_form()
  6. 7.4 twitter.pages.inc \twitter_admin_form()
  7. 7.5 twitter.pages.inc \twitter_admin_form()

Form builder; Twitter settings form.

1 string reference to 'twitter_admin_form'
twitter_menu in ./twitter.module
Implementation of hook_meu()

File

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

Code

function twitter_admin_form() {
  $form = array();
  $form['import'] = array(
    '#type' => 'fieldset',
    '#title' => t('Twitter import'),
    '#description' => t('Import and display the Twitter statuses of site users who have entered their Twitter account information.'),
  );
  $form['import']['twitter_import'] = array(
    '#type' => 'checkbox',
    '#title' => t('Import Twitter statuses'),
    '#default_value' => variable_get('twitter_import', TRUE),
  );
  $periods = array(
    0 => t('Never'),
  );
  $periods += drupal_map_assoc(array(
    604800,
    2419200,
    7257600,
    31449600,
  ), 'format_interval');
  $form['import']['twitter_expire'] = array(
    '#type' => 'select',
    '#title' => t('Delete old statuses'),
    '#default_value' => variable_get('twitter_expire', 0),
    '#options' => $periods,
  );
  $form['oauth'] = array(
    '#type' => 'fieldset',
    '#title' => t('OAuth Settings'),
    '#description' => t(''),
    '#access' => module_exists('oauth_common'),
    '#description' => t('To enable OAuth based access for twitter, you must <a href="@url">register your application</a> with twitter and add the provided keys here.', array(
      '@url' => 'https://dev.twitter.com/apps/new',
    )),
  );
  $form['oauth']['callback_url'] = array(
    '#type' => 'item',
    '#title' => t('Callback URL'),
    '#value' => url('twitter/oauth', array(
      'absolute' => TRUE,
    )),
  );
  $form['oauth']['twitter_consumer_key'] = array(
    '#type' => 'textfield',
    '#title' => t('OAuth Consumer key'),
    '#default_value' => variable_get('twitter_consumer_key', NULL),
  );
  $form['oauth']['twitter_consumer_secret'] = array(
    '#type' => 'textfield',
    '#title' => t('OAuth Consumer secret'),
    '#default_value' => variable_get('twitter_consumer_secret', NULL),
  );

  // Twitter external APIs settings.
  $form['twitter'] = array(
    '#type' => 'fieldset',
    '#title' => t('Twitter Settings'),
    '#description' => t('The following settings connect Twitter module with external APIs. ' . 'Change them if, for example, you want to use Identi.ca.'),
  );
  $form['twitter']['twitter_host'] = array(
    '#type' => 'textfield',
    '#title' => t('Twitter host'),
    '#default_value' => variable_get('twitter_host', TWITTER_HOST),
  );
  $form['twitter']['twitter_api'] = array(
    '#type' => 'textfield',
    '#title' => t('Twitter API'),
    '#default_value' => variable_get('twitter_api', TWITTER_API),
  );
  $form['twitter']['twitter_search'] = array(
    '#type' => 'textfield',
    '#title' => t('Twitter search'),
    '#default_value' => variable_get('twitter_search', TWITTER_SEARCH),
  );
  $form['twitter']['twitter_tinyurl'] = array(
    '#type' => 'textfield',
    '#title' => t('TinyURL'),
    '#default_value' => variable_get('twitter_tinyurl', TWITTER_TINYURL),
  );
  return system_settings_form($form);
}