You are here

function twitter_admin_form in Twitter 7.5

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. 6.4 twitter.pages.inc \twitter_admin_form()
  5. 7.6 twitter.pages.inc \twitter_admin_form()
  6. 7.3 twitter.pages.inc \twitter_admin_form()
  7. 7.4 twitter.pages.inc \twitter_admin_form()

Twitter settings form.

1 string reference to 'twitter_admin_form'
twitter_menu in ./twitter.module
Implements hook_menu().

File

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

Code

function twitter_admin_form($form, &$form_state) {
  $form['misc'] = array(
    '#type' => 'fieldset',
    '#title' => t('Miscellaneous settings'),
  );
  $form['misc']['twitter_import'] = array(
    '#type' => 'checkbox',
    '#title' => t('Import and display the Twitter statuses of site users who have entered their Twitter account information.'),
    '#default_value' => variable_get('twitter_import', 1),
  );
  $form['misc']['twitter_expire'] = array(
    '#type' => 'select',
    '#title' => t('Delete old statuses'),
    '#default_value' => variable_get('twitter_expire', 0),
    '#options' => array(
      0 => t('Never'),
    ) + drupal_map_assoc(array(
      604800,
      2592000,
      7776000,
      31536000,
    ), 'format_interval'),
    '#states' => array(
      'visible' => array(
        ':input[name=twitter_import]' => array(
          'checked' => TRUE,
        ),
      ),
    ),
  );
  $form['misc']['twitter_use_default_views'] = array(
    '#type' => 'checkbox',
    '#title' => t('Use default views'),
    '#description' => t('The module includes custom displays managed by the Views module. Disabling this option will remove the bundled views provided by the Twitter module, allowing them to be more easily customized and exported.'),
    '#default_value' => variable_get('twitter_use_default_views', TRUE),
  );
  $form['oauth'] = array(
    '#type' => 'fieldset',
    '#title' => t('OAuth Settings'),
    '#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://apps.twitter.com/app/new',
    )),
  );
  $form['oauth']['twitter_oauth_callback_url'] = array(
    '#type' => 'textfield',
    '#title' => t('Callback URL'),
    '#default_value' => variable_get('twitter_oauth_callback_url', TWITTER_OAUTH_CALLBACK_URL),
    '#description' => t('There is usually no need to modify this. Defaults to "%path".', array(
      '%path' => TWITTER_OAUTH_CALLBACK_URL,
    )),
  );
  $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),
  );

  // Embed tweet settings.
  $form['embed'] = array(
    '#type' => 'fieldset',
    '#title' => t('Embed Tweet Settings'),
    '#description' => t('The following settings for rendering embedded tweets in your posts.'),
  );
  $form['embed']['twitter_media'] = array(
    '#type' => 'checkbox',
    '#title' => t('Display Media'),
    '#default_value' => variable_get('twitter_media', FALSE),
    '#description' => t('Display images, video and link previews referenced in the tweet.'),
  );
  $form['embed']['twitter_conversation'] = array(
    '#type' => 'checkbox',
    '#title' => t('Conversation view'),
    '#default_value' => variable_get('twitter_conversation', FALSE),
    '#description' => t('Include previous tweets in the reply thread.'),
  );
  $form['embed']['twitter_align'] = array(
    '#type' => 'radios',
    '#title' => t('Alignment'),
    '#options' => array(
      'none' => t('None'),
      'center' => t('Center'),
      'left' => t('Left'),
      'right' => t('Right'),
    ),
    '#default_value' => variable_get('twitter_align', 'none'),
    '#description' => t('Specifies whether the embedded Tweet should be floated left, right, or center in the page relative to the parent element'),
  );
  return system_settings_form($form);
}