You are here

function tweet_admin in Tweet 6.2

Same name and namespace in other branches
  1. 5.2 tweet.module \tweet_admin()
  2. 5 tweet.module \tweet_admin()
  3. 6.4 tweet.admin.inc \tweet_admin()
  4. 6.3 tweet.admin.inc \tweet_admin()
  5. 7.4 tweet.admin.inc \tweet_admin()

Settings page.

1 string reference to 'tweet_admin'
tweet_menu in ./tweet.module
Implementation of hook_menu().

File

./tweet.admin.inc, line 11
Builds links to post pages to twitter.

Code

function tweet_admin() {
  $form['tweet_node'] = array(
    '#type' => 'select',
    '#title' => t('Type of link to show on nodes'),
    '#default_value' => variable_get('tweet_node', 'icon'),
    '#options' => array(
      'icon' => 'icon',
      'icon_text' => 'icon_text',
      'text' => 'text',
      'none' => 'none',
    ),
  );
  $form['tweet_teaser'] = array(
    '#type' => 'select',
    '#title' => t('Type of link to show on teasers'),
    '#default_value' => variable_get('tweet_teaser', 'none'),
    '#options' => array(
      'icon' => 'icon',
      'icon_text' => 'icon_text',
      'text' => 'text',
      'none' => 'none',
    ),
  );
  $form['tweet_new_window'] = array(
    '#type' => 'radios',
    '#title' => t('Open Twitter'),
    '#default_value' => variable_get('tweet_new_window', 'target'),
    '#options' => array(
      0 => t('In same window'),
      'target' => t('In new window with target="_blank" (not XHTML 1.0 Strict compliant)'),
      'js' => t('In new window with JavaScript'),
    ),
  );
  $node_types = variable_get('tweet_types', array());

  //If all types are selected, un-select them, because the system will still save the result as all selected and it looks better.
  if ($node_types == _tweet_node_types()) {
    $node_types = array();
  }
  $form['tweet_types'] = array(
    '#type' => 'select',
    '#multiple' => TRUE,
    '#title' => t('Node types on which to display link'),
    '#description' => t('If no types are selected, the link will appear on all types.  To stop links from appearing on all nodes, choose "none" in the teaser and node display options above.'),
    '#default_value' => $node_types,
    '#options' => _tweet_node_types(),
  );
  $image_location = drupal_get_path('module', 'tweet') . '/icon.png';
  $form['tweet_image'] = array(
    '#type' => 'textfield',
    '#title' => t('Image'),
    '#description' => t('Enter the URL for the image you want to show up if you allow images to appear in your links, relative to your Drupal installation.  Ex.: sites/all/modules/tweet/icon.png'),
    '#default_value' => variable_get('tweet_image', $image_location),
  );
  $form['tweet_exclude'] = array(
    '#type' => 'textfield',
    '#title' => t('Exclude nodes'),
    '#description' => t('Enter the NIDs of nodes which should not have Tweet links, separated by commas.'),
    '#default_value' => variable_get('tweet_exclude', ''),
  );
  $form['tweet_format'] = array(
    '#type' => 'textfield',
    '#title' => t('Format'),
    '#description' => t('Manipulate the elements of the tweet by changing their order, removing them, or adding them (like hashtags).  You can use the case-insensitive tokens [url] and [title].'),
    '#maxlength' => 140,
    '#default_value' => variable_get('tweet_format', '[url] [title]'),
  );
  return system_settings_form($form);
}